0

I am working on an app where I am using the NavigationDrawerActivity. When I tap on the hamburger icon, the navigation drawer slides in. But it covers the animation from hamburger to arrow. Is there anyway I can use my NavigationDrawer below the actionbar instead of over the actionbar.

How I want is this: Arrow and animation is visible

How I am getting is this: Drawer covers the animation

atiruz
  • 2,782
  • 27
  • 36
The Bat
  • 1,085
  • 1
  • 13
  • 31

2 Answers2

0

It's very simple. You just need to change activity_layout.xml

If you have created Activity with NavigationDrawer use see the following:

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

And You need to change it to

<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> 
AndreyICE
  • 3,574
  • 29
  • 27
0

Try this !

 <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>
Tosin Onikute
  • 3,883
  • 6
  • 38
  • 61