如何在工具栏下方设置NavitagionView?

什么是我的昵称

我有自定义工具栏和Navigationview。但是,当我打开navigationview时,它看起来是全屏的。我想要它在工具栏的下面。我该如何解决?这是我的activity_main.xml

<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的方法,但是在任何时候都出现错误。请帮忙?

乌古尔

在顶部使用LinearLayout或Relative Layout,然后将您的抽屉式布局放在您想要的顶部下方(工具栏,标签等)。并将您的内容放入您的抽屉式布局中。

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在外部/下方工具栏显示SearchView

来自分类Dev

如何在Android工具栏下方启动抽屉布局?

来自分类Dev

如何使DrawerLayout显示在工具栏下方?

来自分类Dev

如何在列表活动中设置工具栏?

来自分类Dev

如何在工具栏的末尾设置图标

来自分类Dev

如何在FragmentActivity上设置工具栏?

来自分类Dev

RecyclerView在工具栏下方

来自分类Dev

工具栏下方的白条

来自分类Dev

滚动时如何在工具栏下方固定两个按钮

来自分类Dev

如何将导航抽屉放在工具栏下方?

来自分类Dev

如何消除工具栏和下方布局之间的间隙

来自分类Dev

如何设置ReportViewer工具栏的样式

来自分类Dev

如何设置ReportViewer工具栏的样式

来自分类Dev

gtkmm,如何设置工具栏?

来自分类Dev

如何设置工具栏按钮的大小

来自分类Dev

如何动态设置工具栏的颜色

来自分类Dev

如何在Android工具栏操作栏中为微调框设置正确的文本大小

来自分类Dev

工具栏下方的AppBarLayout滚动内容

来自分类Dev

在工具栏下方添加片段

来自分类Dev

在工具栏下方添加片段

来自分类Dev

如何在自动调整大小上设置日期搜索工具栏字段的宽度

来自分类Dev

如何在工具栏上的溢出菜单中的菜单项上设置字体

来自分类Dev

Android-如何在工具栏中设置项目以填充所有可用空间?

来自分类Dev

如何在React Native中设置工具栏动作图标?

来自分类Dev

如何在Android工具栏导航图标中设置复选框?

来自分类Dev

如何在工具栏上的后退箭头上显示和设置单击事件?

来自分类Dev

用户滚动时,如何在工具栏中为视图设置动画?

来自分类Dev

如何在不扩展actionbaractivity的情况下设置app.compat actionbar工具栏?

来自分类Dev

如何在工具栏上的溢出菜单中的菜单项上设置字体

Related 相关文章

  1. 1

    如何在外部/下方工具栏显示SearchView

  2. 2

    如何在Android工具栏下方启动抽屉布局?

  3. 3

    如何使DrawerLayout显示在工具栏下方?

  4. 4

    如何在列表活动中设置工具栏?

  5. 5

    如何在工具栏的末尾设置图标

  6. 6

    如何在FragmentActivity上设置工具栏?

  7. 7

    RecyclerView在工具栏下方

  8. 8

    工具栏下方的白条

  9. 9

    滚动时如何在工具栏下方固定两个按钮

  10. 10

    如何将导航抽屉放在工具栏下方?

  11. 11

    如何消除工具栏和下方布局之间的间隙

  12. 12

    如何设置ReportViewer工具栏的样式

  13. 13

    如何设置ReportViewer工具栏的样式

  14. 14

    gtkmm,如何设置工具栏?

  15. 15

    如何设置工具栏按钮的大小

  16. 16

    如何动态设置工具栏的颜色

  17. 17

    如何在Android工具栏操作栏中为微调框设置正确的文本大小

  18. 18

    工具栏下方的AppBarLayout滚动内容

  19. 19

    在工具栏下方添加片段

  20. 20

    在工具栏下方添加片段

  21. 21

    如何在自动调整大小上设置日期搜索工具栏字段的宽度

  22. 22

    如何在工具栏上的溢出菜单中的菜单项上设置字体

  23. 23

    Android-如何在工具栏中设置项目以填充所有可用空间?

  24. 24

    如何在React Native中设置工具栏动作图标?

  25. 25

    如何在Android工具栏导航图标中设置复选框?

  26. 26

    如何在工具栏上的后退箭头上显示和设置单击事件?

  27. 27

    用户滚动时,如何在工具栏中为视图设置动画?

  28. 28

    如何在不扩展actionbaractivity的情况下设置app.compat actionbar工具栏?

  29. 29

    如何在工具栏上的溢出菜单中的菜单项上设置字体

热门标签

归档