2016-03-20 4 views
1

Ich habe benutzerdefinierte Symbolleiste und Navigationssicht. Aber wenn ich navigationview öffne, sieht es Vollbild aus. Ich möchte es unterhalb der Symbolleiste. Wie kann ich es reparieren ? Hier ist meine activity_main.xml:Wie kann ich NavitagionView unter der Toolbar einstellen?

<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"> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:id="@+id/container_app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <include --> MY CUSTOM TOOLBAR 
      android:id="@+id/app_bar" 
      layout="@layout/app_bar" /> 

     <FrameLayout 
      android:id="@+id/flContent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

     <it.neokree.materialtabs.MaterialTabHost 
      android:id="@+id/materialTabHost" 
      android:layout_width="match_parent" 
      android:layout_height="48dp" 
      android:layout_below="@+id/app_bar" 
      app:accentColor="@color/colorPrimaryLight" 
      app:hasIcons="true" 
      app:iconColor="@android:color/white" 
      app:materialTabsPrimaryColor="#009688" /> 
    </LinearLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewPager" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_below="@+id/materialTabHost" 
     android:layout_weight="1" /> 
</LinearLayout> 

<android.support.design.widget.NavigationView 
    app:theme = "@style/NavigationViewStyle" 
    android:id="@+id/nvView" 
    android:layout_width="250dp" 
    app:itemIconTint="@color/colorPrimaryDark" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:background="#fff" 
    app:menu="@menu/drawer_view" /> 

ich mehrere Art und Weise für die Show navigationdrawer unten Symbolleiste versucht, aber ich habe Fehler an jeder Ecke. Hilfe bitte?

Antwort

0

Verwenden Sie LinearLayout oder Relative Layout oben und legen Sie Ihr Drawerlayout unter dem, was Sie wollen oben (Symbolleiste, Registerkarte usw.). und legen Sie Ihren Inhalt in Ihr Schubladenlayout.

<LinearLayout 
     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:orientation="vertical"> 

     <LinearLayout 
      android:id="@+id/container_app_bar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <include --> MY CUSTOM TOOLBAR 
       android:id="@+id/app_bar" 
       layout="@layout/app_bar" /> 

      <it.neokree.materialtabs.MaterialTabHost 
       android:id="@+id/materialTabHost" 
       android:layout_width="match_parent" 
       android:layout_height="48dp" 
       android:layout_below="@+id/app_bar" 
       app:accentColor="@color/colorPrimaryLight" 
       app:hasIcons="true" 
       app:iconColor="@android:color/white" 
       app:materialTabsPrimaryColor="#009688" /> 
     </LinearLayout> 

     <android.support.v4.widget.DrawerLayout 
      android:id="@+id/drawer_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:clickable="true" 
      android:focusableInTouchMode="true"> 

      <android.support.v4.view.ViewPager 
      android:id="@+id/viewPager" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_below="@+id/materialTabHost" 
      android:layout_weight="1" /> 


      <android.support.design.widget.NavigationView 
       android:id="@+id/navView" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_gravity="start" 
       android:background="@android:color/white" 
       app:headerLayout="@layout/nav_header" 
       app:menu="@menu/menu_drawer" > 
     </android.support.design.widget.NavigationView> 


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

    </LinearLayout> 
+0

Sağol kardeşim :) Danke, es hat funktioniert. – whatwasmynickname

+0

ne demek;) kannst du als richtige antwort akzeptieren. – uguboz

Verwandte Themen