来自操作栏的导航抽屉

时间:2015-09-19 05:37:41

标签: android android-layout android-actionbar navigation-drawer

我正在使用支持库的导航抽屉。我正在使用最新的材料设计布局。请有人回答。

  

块引用

MainLayout.xml

<android.support.design.widget.NavigationView
    android:id="@+id/shitstuff"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/nav_header"
    app:itemIconTint="@color/primaryColorDark"
    app:itemTextColor="@color/black"
    app:menu="@menu/drawermenu" />

2 个答案:

答案 0 :(得分:0)

取一个LinearLayout并将工具栏放在工具栏的第一个和工具栏下面。

(sensor, taken)

答案 1 :(得分: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"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:background="@color/gray93"
    android:layout_height="match_parent"
    android:elevation="7dp">
    <!-- Main activity home page -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- Toolbar layout -->
        <include layout="@layout/toolbar" />

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


    </LinearLayout>



    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/nav_drawer_header"
        app:menu="@menu/menu_drawer" />

</android.support.v4.widget.DrawerLayout>
相关问题