2017-03-13 2 views
0

임지고 다음과 같은 런타임 오류 :RuntimeException : 2 진 XML 파일 행 가져 오기 : layout_width 속성을 제공해야합니다. 속성이 누락 된 곳은 어디입니까?

android.view.InflateException: Binary XML file line #24: Binary XML file line #15: You must supply a layout_width attribute. 

나는 내 코드를 여러 번 확인했지만 나는 내가 layout_width 속성을 놓친 어떤 장소를 찾을 수 없습니다. 문제가 어디에 있습니까?

item.xml :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 

    android:id="@+id/myDate"/> 


<TextView 
    android:layout_below="@id/myDate" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/myTime"/> 

</RelativeLayout> 

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context="com.example.nirvan.recyclerview.MainActivity"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 



</android.support.design.widget.AppBarLayout> 

<include layout="@layout/content_main" /> 



</android.support.design.widget.CoordinatorLayout> 

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.nirvan.recyclerview.MainActivity" 
tools:showIn="@layout/activity_main"> 

<android:android.support.v7.widget.RecyclerView 
    layout_height="match_parent" 
    layout_width="match_parent" 
    android:id="@+id/rv"/> 




</RelativeLayout> 

답변

2
<android:android.support.v7.widget.RecyclerView 
    layout_height="match_parent" 
    layout_width="match_parent" 
    android:id="@+id/rv"/> 

이어야합니다.
<android:android.support.v7.widget.RecyclerView 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:id="@+id/rv"/> 
관련 문제