2016-03-20 4 views
1

私はカスタムツールバーとナビゲーションビューを持っています。しかし、私はナビゲーションビューを開くと、それはフルスクリーンに見えます。私はツールバーの下にそれをしたい。どうすれば修正できますか?ここに私のactivity_main.xmlです:NavitagionViewをツールバーの下に設定するにはどうすればよいですか?

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

私は、ツールバーの下にショーnavigationdrawerのためのいくつかの方法を試してみましたが、私は毎ターンでのエラーを得ました。助けてください?

答えて

0

上にLinearLayoutまたは相対レイアウトを使用して、上に必要なもの(ツールバー、タブなど)の下にウル引き出しを配置し​​ます。ウルの引き出しレイアウトの中にウルのコンテンツを入れてください。

<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ğolkardeşim:)ありがとう、それは働いた。 – whatwasmynickname

+0

ne demek;)正しい答えとして受け入れることができます。 – uguboz

関連する問題