0

My NavigationViewがページコンテンツの後ろに表示されます。そこで、私はNavigationViewにbringToFrontを使用しようとしました。ページコンテンツはNavigationViewの後ろにあり、は解除不可/不可能になります(ページコンテンツは複数のアイテムを持つrecyclerViewです)。NavigationViewとページコンテンツの両方を処理する

NavigationViewとページコンテンツの両方をどのように処理できますか? NavigationViewが閉じている場合でも 、RecyclerViewはここ

unscrollable/unclickableである私のレイアウトファイルです:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="@color/background_color"> 


    <include android:id="@+id/mytoolbar" 
     layout="@layout/toolbar"/> 

    <android.support.v4.widget.DrawerLayout 
     android:id="@+id/drawer_layout" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:layout_below="@+id/mytoolbar" 
     > 

     <android.support.design.widget.NavigationView 
      android:id="@+id/nav_view" 
      android:layout_height="match_parent" 
      android:layout_width="wrap_content" 
      android:layout_gravity="start" 
      android:fitsSystemWindows="true" 
      app:menu="@menu/drawer_menu_planvente"/> 

    </android.support.v4.widget.DrawerLayout> 

    <RelativeLayout 
     android:id="@+id/layoutPlanVente" 
     android:layout_below="@+id/mytoolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 


     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerViewProduitsVente" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbars="vertical" 
      android:scrollbarSize="50dp" 
      android:orientation="vertical"> 

     </android.support.v7.widget.RecyclerView> 

    </RelativeLayout> 

</RelativeLayout> 

答えて

0

次のようにレイアウトを更新:FATの答えに触発

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawer_layout" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent"> 

    <!-- Content --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <include android:id="@+id/mytoolbar" 
      layout="@layout/toolbar"/> 

     <RelativeLayout 
      android:id="@+id/layoutPlanVente" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/recyclerViewProduitsVente" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scrollbars="vertical" 
       android:scrollbarSize="50dp" /> 
     </RelativeLayout> 
    </LinearLayout> 

    <!-- Navigation --> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_height="match_parent" 
     android:layout_width="wrap_content" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:menu="@menu/drawer_menu_planvente" /> 

</android.support.v4.widget.DrawerLayout> 
+0

このレイアウトでは、ツールバーとナビゲーションビューが表示されますが、RecyclerViewは表示されません。 – macTAR

0

を私はこのレイアウトで動作させました:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="@color/background_color"> 

    <include android:id="@+id/mytoolbar" 
     layout="@layout/toolbar"/> 

    <android.support.v4.widget.DrawerLayout 
     android:id="@+id/drawer_layout" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:layout_below="@+id/mytoolbar" 
     > 

     <RelativeLayout 
      android:id="@+id/layoutPlanVente" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 


      <android.support.v7.widget.RecyclerView 
       android:id="@+id/recyclerViewProduitsVente" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scrollbars="vertical" 
       android:scrollbarThumbVertical="@drawable/scrollbar_custom" 
       android:orientation="vertical"> 
      </android.support.v7.widget.RecyclerView> 

     </RelativeLayout> 


     <android.support.design.widget.NavigationView 
      android:id="@+id/nav_view" 
      android:layout_height="match_parent" 
      android:layout_width="wrap_content" 
      android:layout_gravity="start" 
      android:fitsSystemWindows="true" 
      app:menu="@menu/drawer_menu_planvente"/> 

    </android.support.v4.widget.DrawerLayout> 

</RelativeLayout> 
関連する問題