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.
Asked
Active
Viewed 329 times
0
-
1If your are using toolbar, check this : http://stackoverflow.com/questions/32007187/navigation-drawer-covers-my-toolbar – onur taskin Jan 14 '16 at 12:24
-
avoid to use navigation view – Yogesh Seralia Jan 14 '16 at 12:30
-
Please add your code.. – yennsarah Jan 14 '16 at 12:39
2 Answers
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
-
If I do this, then the actionbar goes too up into the battery and network icons – The Bat Jan 14 '16 at 12:39
-
-
In additional: if you have in project v21/styles.xml check
- true
and set needed color to- @android:color/transparent
– AndreyICE Jan 14 '16 at 13:05
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