2017-03-28 1 views
0

リストビューとナビゲーションがリストビューと重なってナビゲーションバーがアクセスできないようになったレイアウトです。それを正しく設定することができませんでした。ここで私はそれを実行するときに表示されます。リストビューは、私がロリポップ以上でテストするとツールバーに表示されます。

List View

<?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"> 
      <android.support.v4.widget.DrawerLayout 
       android:id="@+id/drawer_layout" 
       android:layout_height="match_parent" 
       android:layout_width="fill_parent" 
       android:fitsSystemWindows="true"> 
      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical"> 
       <include 
        layout="@layout/toolbar" /> 

       </RelativeLayout> 
       <ListView 
         android:id="@+id/listview" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:dividerHeight="1px" 
         android:layout_weight="1" 
         android:layout_marginTop="100dp" 
         android:divider="#000000" 
         android:layout_marginLeft="10dp" 
         android:layout_marginRight="10dp" 
         android:paddingLeft="5dp" /> 
      <android.support.design.widget.NavigationView 
        android:id="@+id/nav_view" 
        android:layout_height="match_parent" 
        android:layout_width="wrap_content" 
        android:layout_gravity="end" 
        android:fitsSystemWindows="true" 
       /> 
      </android.support.v4.widget.DrawerLayout> 
      <android.support.design.widget.FloatingActionButton 
        android:id="@+id/fab" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="bottom|right" 
        android:src="@drawable/ic_edit" 
        android:layout_marginRight="15dp" 
        android:layout_marginBottom="15dp" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentRight="true" /> 

     </RelativeLayout> 

Can anybody help. 

Thank you. 

答えて

0

あなたはRelativeLayoutを使用しているので、あなたはコードがそのようになります "layout_below" パラメータ を使用することができます。CoordinatorLayoutを使用して

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
     <include 
      android:id="@+id/toolbar" 
      layout="@layout/toolbar" /> 
     <ListView 
       android:id="@+id/listview" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@id/toolbar" 
       android:dividerHeight="1px" 
       android:divider="#000000" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:paddingLeft="5dp" /> 
    </RelativeLayout> 
+0

デバッグ時にツールバーに未処理の例外が表示されます。 –

0

は私の問題を解決しました。

<?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"> 
    <android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/drawer_layout" 
     android:layout_height="match_parent" 
     android:layout_width="fill_parent" 
     android:fitsSystemWindows="true"> 
    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/coordinatorLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <FrameLayout 
      android:id="@+id/content_frame" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 
    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 
     <include 
      layout="@layout/toolbar" /> 

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

    <ListView 
     android:id="@+id/lvTenant" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:dividerHeight="1px" 
     android:layout_marginTop="50dp" 
     android:divider="#000000" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     android:paddingLeft="5dp" /> 
    </android.support.design.widget.CoordinatorLayout> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_height="match_parent" 
     android:layout_width="240dp" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" /> 
    </android.support.v4.widget.DrawerLayout> 
    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:src="@drawable/ic_edit" 
     android:layout_marginRight="15dp" 
     android:layout_marginBottom="15dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     layout_anchor="@id/lvTenant"`enter code here` 
      layout_anchorGravity="bottom|right|end" 
      layout_behavior="helpers.FABCoordinatorBehavior" /> 
</RelativeLayout> 
関連する問題