导航抽屉盖箭头 android

Navigation Drawer Covers arrow android

我正在开发一个使用 NavigationDrawerActivity 的应用程序。 当我点击汉堡包图标时,导航抽屉滑入。但它覆盖了从汉堡包到箭头的动画。 无论如何我可以在操作栏下方而不是在操作栏上方使用我的 NavigationDrawer。

我想要的是这样的:

我是这样得到的:

很简单。你只需要改变 activity_layout.xml

如果您使用 NavigationDrawer 创建了 Activity,请参阅以下内容:

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

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

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

并且您需要将其更改为

<RelativeLayout
... 
android:fitsSystemWindows="true"
>

    <android.support.design.widget.AppBarLayout
          android:id="@+id/app_bar_layout"
    ...
    >

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

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

    <android.support.v4.widget.DrawerLayout
        android:layout_below="@id/app_bar_layout"
    ... 
    >

        <include
            layout="@layout/app_bar_main"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

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

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

</RelativeLayout> 

试试这个!

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


        <!-- The ActionBar -->
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:fitsSystemWindows="true"
            android:minHeight="?attr/actionBarSize"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:background="?attr/colorPrimaryDark">
        </android.support.v7.widget.Toolbar>

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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">


                <!-- The main content view, you should replace this with your content -->

                <TextView
                    android:id="@+id/textme"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    />
               <!-- The main content view -->


            </LinearLayout>


            <android.support.design.widget.NavigationView
                android:id="@+id/nvView"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                app:headerLayout="@layout/nav_header"
                app:menu="@menu/drawer_view"
                android:theme="@style/navbody"
                />

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

    </LinearLayout>