2016-08-07 14 views
0

Ich möchte, dass der Inhalt meiner Recycleransicht unterhalb der Navigationsleiste angezeigt wird. Die Ansicht "Recyler" wird in den Pager für die Ansicht übernommen. Ich habe versucht, clipToPadding = "false", machte den navigationBarTranslucent im Stil, aber nichts scheint zuWie lege ich Inhalte unter die Navigationsleiste?

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

     <android.support.design.widget.CoordinatorLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <android.support.design.widget.AppBarLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <android.support.v7.widget.Toolbar 
        android:id="@+id/fragment_main_toolbar" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        android:title="@string/app_name" 
        app:titleTextColor="@android:color/white" 
        app:layout_scrollFlags="scroll|enterAlways"/> 

       <android.support.design.widget.TabLayout 
        android:id="@+id/fragment_main_tab_layout" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:minHeight="?attr/actionBarSize" 
        app:tabIndicatorColor="@android:color/white" 
        app:tabSelectedTextColor="@android:color/white" 
        app:tabTextColor="@color/tab_unselected" 
        > 

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

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

      <android.support.v4.view.ViewPager 
       android:id="@+id/fragment_main_view_pager" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

      </android.support.v4.view.ViewPager> 

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

     <android.support.design.widget.NavigationView 
      android:id="@+id/fragment_main_navigation_view" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start"> 

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

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

Hier ist die Recycler Ansicht

<android.support.v7.widget.RecyclerView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/recycler_view" 
    android:orientation="vertical" 
    android:clipToPadding="false" 
    android:fitsSystemWindows="true"> 

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

Antwort

0

versuchen dies funktioniert:

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

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <android.support.design.widget.AppBarLayout 
      android:id="@+id/appBarLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/fragment_main_toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:title="@string/app_name" 
       app:titleTextColor="@android:color/white" 
       app:layout_scrollFlags="scroll|enterAlways"/> 

      <android.support.design.widget.TabLayout 
       android:id="@+id/fragment_main_tab_layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:minHeight="?attr/actionBarSize" 
       app:tabIndicatorColor="@android:color/white" 
       app:tabSelectedTextColor="@android:color/white" 
       app:tabTextColor="@color/tab_unselected" 
       > 

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

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

     <android.support.v4.view.ViewPager 
      android:id="@+id/fragment_main_view_pager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/appBarLayout" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     </android.support.v4.view.ViewPager> 

    </RelativeLayout> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/fragment_main_navigation_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start"> 

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

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

Das hat nicht funktioniert, es hat auch mein appbar Layout unbrauchbar –

+0

Ich änderte es, versuchen Sie es erneut –

0
 <?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 
    <include 
    android:id="@+id/act_bar" 
    layout="@layout/app_bar_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:headerLayout="@layout/nav_header_main"> 
    <android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/recycler_view" 
    android:orientation="vertical" 
    android:clipToPadding="false" 
    android:fitsSystemWindows="true"> 

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


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

Dies würde für Sie arbeiten

Verwandte Themen