-2
내가 런타임 오류 및 안드로이드 응용 프로그램이 정지에게

나는 런타임 오류 # 25은 무엇입니까 : 당신은 layout_width 속성을 제공해야합니다

android.view.InflateException지고 점점 오전

: 바이너리 XML 파일 라인 # 9 : 바이너리 XML 파일을 라인 # 9 : 오류 팽창 클래스 android.support.design.widget.NavigationView

에 의해 발생 : android.view.InflateException : 바이너리 XML 파일 라인 # 9 : 오류가 팽창 클래스 android.support.design.widget.NavigationView

android.view.InflateException : 바이너리 XML 파일 라인 # 25 : 바이너리 XML 파일

에 의한 line # 25 : layout_width 속성을 제공해야합니다. 발생 원인 : java.lang.UnsupportedOperationException : 이진 XML 파일 라인 # 25 : layout_width 특성을 제공해야합니다.

여기 여기 내 XML 코드

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
tools:context="com.example.xxx.xxx.Main_Tab" 
> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/activity_main_drawer" > 
    <include 
     layout="@layout/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</android.support.design.widget.NavigationView> 

<android.support.design.widget.TabLayout 
    android:id="@+id/tab_layout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/nav_view" 
    android:background="#00BCD4" 

    android:minHeight="?attr/actionBarSize" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

<android.support.v4.view.ViewPager 
    android:id="@+id/pager1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/tab_layout1"/> 


</RelativeLayout> 

여기 app_bar.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.xxx.xxx.Main_Tab"> 

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

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="#8BC34A" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 

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

<FrameLayout 
    android:id="@+id/frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> </FrameLayout> 
</android.support.design.widget.CoordinatorLayout> 

입니다

<?xml version="1.0" encoding="utf-8"?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android" 

> 
<group android:checkableBehavior="single"> 
    <item 
     android:id="@+id/nav_home" 
     android:icon="@drawable/ic_home_black_24dp" 
     android:title="@string/nav_home" /> 

    <item 
     android:id="@+id/nav_notifications" 
     android:icon="@drawable/ic_notifications_black_24dp" 
     android:title="@string/nav_notifications" /> 
    </group> 

    <item android:title="Other"> 
    <menu> 
     <item 
      android:id="@+id/nav_about_us" 
      android:title="@string/nav_about_us" /> 
     <item 
      android:id="@+id/nav_privacy_policy" 
      android:title="@string/privacy_policy" /> 
    </menu> 
</item> 

</menu> 
+0

해당 줄의 너비를 지정하십시오. 예 : 150dp –

+0

문제는 '@ layout/app_bar'에있는 것 같습니다. 게시 할 수 있습니까? –

+0

app_bar.xml에서 layout_width가 누락되었습니다. 그것을 확인하십시오. – tahsinRupam

답변

0

레이아웃이 잘 될 것 같다 activity_main_drawer 코드입니다. 하지만이 레이아웃에는 몇 가지 레이아웃이 추가되었습니다.

app:headerLayout="@layout/nav_header_main" 
app:menu="@menu/activity_main_drawer" 

<include 
    layout="@layout/app_bar" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

대부분의 아마 당신은이 레이아웃 @layout/app_bar, @layout/nav_header_main, @menu/activity_main_drawer의 어느 하나에 android:layout_width 속성이 누락되어 있습니다.

+0

@ menu/activity_main_drawer 체크 아웃을 게시했습니다 –

+0

nav_header_main에 android : layout_width이 (가) 있습니다. –

관련 문제