Prevent statusbar to be shown over NavigationView in devices with Notch - android

I have an issue with my NavigationView, when it's expanded the statusBar is shown in semitransparent color over it and i would hide it completely by still keeping notch support.
It looks like this now:
I've tried to add
android:fitsSystemWindows="false" in my Activity but nothing chanded.
My styles.xml looks like this:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorAccent</item>
<item name="primaryTextColor">#F4F4F6</item>
<item name="colorControlNormal">#color/colorAccent</item>
<item name="secondaryTextColor">#96000000</item>
<item name="recyclerViewTitleColor">#96000000</item>
<item name="navColor">#2948ff</item>
<item name="colorTurni">#color/blueLight</item>
<item name="varianti">#color/green</item>
<item name="blueDark">#color/blueDark</item>
<item name="backgroundCardColor">#FFFF</item>
<item name="bottomSheetDialogTheme">#style/ThemeOverlay.App.BottomSheetDialog</item>
<item name="android:windowLayoutInDisplayCutoutMode">
shortEdges
</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
What i would reach is this:
Activity.xml
<androidx.drawerlayout.widget.DrawerLayout android:id="#+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FAFAFA"
android:orientation="vertical"
tools:context="it.gabtamagnini.visualposmobile.PtermActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
...
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_menu"
android:layout_width="185dp"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:background="#color/white"
android:layout_gravity="start"
app:headerLayout="#layout/layout_header">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerViewMenu"
android:layout_width="match_parent"
android:layout_marginTop="120dp"
android:layout_height="match_parent"
tools:listitem="#layout/layout_menu"
android:clipToPadding="false"
android:paddingBottom="15dp"
android:paddingEnd="5dp"
android:paddingStart="5dp" />
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>

Cause:
This shadow is related to the drawable used for the inset foreground which is customized to R.styleable.ScrimInsetsFrameLayout_insetForeground style by default on the NavigationView; this answer explains more about the ScrimInsetsFrameLayout class.
Solution:
Getting rid of this drawable from the NavigationView either programmatically or in layout:
Programmatically: setting setScrimInsetForeground to null.
navView.setScrimInsetForeground(null)
In layout: using app:insetForeground="#null":
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_menu"
....
app:insetForeground="#null"/>

Use this in your NavigationView not in activity
android:fitsSystemWindows="false"
it will solve your issue

Related

Toolbar is not showing below API 21 in Android

Toolbar is not showing when run below API 21. Currently, I am running this app it in API 19 emulator.
This same layout works properly in devices running above and equal to API 21.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".pdfScreen.PdfActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="#+id/pdf_activity_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<com.github.barteksc.pdfviewer.PDFView
android:id="#+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="#+id/include_pdf_menu"
layout="#layout/pdf_activity_bottom_menu"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
Here is the style.xml
<style name="themeForApp" parent="Theme.AppCompat.Light.NoActionBar">
Customize your theme here.
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColor">#color/textOnPrimary</item>
</style>
<style name="pdfViewTheme" parent="themeForApp.NoActionBar">
</style>
Here is v21/style.xml.
<style name="themeForApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
</style>
<style name="pdfViewTheme" parent="themeForApp">
<item name="android:windowFullscreen">true</item>
</style>
Here is the AndroidManifest.xml where I am applying pdfViewTheme to my activity
<activity android:name=".pdfScreen.PdfActivity" android:theme="#style/pdfViewTheme"/>
The issue is the android:layout_height="match_parent"
<com.github.barteksc.pdfviewer.PDFView
android:layout_height="match_parent" />
In this way the PDFView covers the whole screen including the Toolbar with API<21.
The reason is that AppBar/Toolbar has a default elevation and is positioned at higher elevations than others. It doesn't work on API<21.

Transparent toolbar with menu icon and title not working

My title bar looks like this:
I'm trying to make it transparent to get only the navigation icon & map full screen into the map view, but every time I am trying the transparent code to make the bar transparent it's ended up showing the white color.
I also try ed NoAction bar but its still ended up showing a white title bar.
Home_activity.xml
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:scrollbars="horizontal">
<RelativeLayout
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="center"
android:background="#android:color/transparent"
android:fitsSystemWindows="true"
app:popupTheme="#style/Theme.AppCompat.NoActionBar">
</android.support.v7.widget.Toolbar>
<!-- The first child in the layout is for the main Activity UI-->
<FrameLayout
android:id="#+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="#+id/drawer_layout"
android:scrollbars="horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</FrameLayout>
</LinearLayout>
<!-- Side navigation drawer UI -->
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/navigation_header"
app:itemBackground="#drawable/naviagtionview_statecolor"
app:itemIconTint="#color/black"
app:itemTextColor="#color/black"
app:menu="#menu/my_navigation_items">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
style.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/hint</item>
<item name="drawerArrowStyle">#style/MyDrawerArrowToggle</item>
<item name="colorPrimaryDark">#color/hint</item>
<item name="colorAccent">#color/black</item>
<item name="actionBarStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#android:color/transparent</item>
<item name="android:backgroundStacked">#android:color/transparent</item>
<item name="android:displayOptions">showTitle</item>
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="drawerArrowStyle">#style/MyDrawerArrowToggle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance">
<item name="android:textColor">#color/black</item>
</style>
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">#color/black</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="EditText.Login" parent="Widget.AppCompat.EditText">
<item name="android:textColor">#android:color/black</item>
<item name="android:textColorHint">#android:color/darker_gray</item>
<item name="colorAccent">#color/yellow</item>
<item name="colorControlNormal">#color/black</item>
<item name="colorControlActivated">#color/yellow</item>
</style>
But it's showing like this:
I had a similar issue,
I used different ways to implement it,
you may try this to make toolbar transperent.

Android DrawerLayout (with NavigationView) behind status bar

I have an app with a DrawerLayout that contains a NavigationView:
activity_layout.xml:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/drawer_layout"
android:fitsSystemWindows="true">
<android.support.constraint.ConstraintLayout
android:id="#+id/activity_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.exmaple.appname.activityname">
<android.support.v7.widget.Toolbar
android:id="#+id/actionbar_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="#style/Theme.AppCompat"/>
[…]
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="#menu/nav_drawer"
android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout>
I have added the following styles as well:
styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
[…]
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
values-21/styles.xml:
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
</style>
All of this code is based on the Google I/O Schedule App, however the DrawerLayout still does not render behind the status bar. Any ideas as to why this combination of solutions isn't working and what solutions might? I've found that drawing behind the status bar is never a one-size-fits-all solution, but after trying every combination of solutions on Stack Overflow that I can think of, I still can't get it.
Current drawer image:
Just add <item name="android:windowTranslucentStatus">true</item> in values-21/styles.xml and remove this <item name="android:statusBarColor">#android:color/transparent</item>
add android:fitsSystemWindows="true" to your NavigationView in xml
Working example!
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
Result
Edited (main layout)
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" <--This is mandatory
tools:context=".ui.activities.MainActivity">
<FrameLayout
android:id="#+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white" />
<android.support.design.widget.NavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/colorPrimary"
android:fitsSystemWindows="true" /><--This is mandatory
</android.support.v4.widget.DrawerLayout>
Current Result
Update: I lookup your style-v21 and found below
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
Please replace it with this
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>

Android Support Toolbar shadow API > 19

Using android.support.v7.widget.Toolbar, I find that it displays a weird shadow in devices with API > 19.
How it looks in Android 4.4.2 API 19:
How it looks in anything with API >19:
I'd need it to look like it does with API 19, where it does not have any shadows and rather "integrates" with the background.
Since I'm using this Activity with a DrawerLayout, I have 2 layouts.
activity_main_tabbed.xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_tabbed_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:openDrawer="right">
<include
layout="#layout/activity_main_tabbed_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:fitsSystemWindows="true" />
</android.support.v4.widget.DrawerLayout>
activity_main_tabbed_content.xml
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="#drawable/activity_background_vertical"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="#android:color/transparent">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="#dimen/action_bar_height"
android:elevation="0dp"
android:background="#android:color/transparent"
app:layout_scrollFlags="scroll|enterAlways">
<ImageView
android:layout_width="wrap_content"
android:id="#+id/btn_toolbar_back"
android:src="#drawable/left_white_arrow"
android:visibility="gone"
android:layout_height="match_parent"
android:layout_marginRight="#dimen/btn_back_toolbar_margin_right"
android:minHeight="#dimen/btn_back_toolbar_height"
android:minWidth="#dimen/btn_back_toolbar_width"
android:layout_gravity="left|center_vertical"/>
<rokk3rlabs.dingding.utils.views.FontTextView
android:layout_width="wrap_content"
android:textSize="#dimen/toolbar_text_size"
android:layout_height="wrap_content"
android:textColor="#color/colorPrimary"
android:text="#string/toolbar_title"
android:layout_gravity="left"
android:id="#+id/toolbar_title" />
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="#dimen/action_bar_height"
app:tabMode="fixed"
android:elevation="0dp"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<!-- <item name="android:windowBackground">#drawable/activity_background</item>-->
<item name="android:textColorPrimaryInverse">#color/colorPrimary</item>
<item name="android:textColorSecondaryInverse">#color/colorPrimary</item>
<item name="android:colorBackground">#color/colorPrimaryDark</item>
<item name="android:colorForeground">#color/colorPrimary</item>
<item name="android:textColorPrimary">#color/colorPrimary</item>
<item name="android:textColorSecondary">#color/colorPrimary</item>
<item name="android:windowBackground">#color/colorPrimary</item>
</style>
styles.xml (v21)
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorPrimaryInverse">#color/colorPrimary</item>
<item name="android:textColorSecondaryInverse">#color/colorPrimary</item>
<item name="android:colorBackground">#color/colorPrimaryDark</item>
<item name="android:colorForeground">#color/colorPrimary</item>
<item name="android:textColorPrimary">#color/colorPrimary</item>
<item name="android:textColorSecondary">#color/colorPrimary</item>
<item name="android:navigationBarColor">#color/navigationBarColor</item>
<item name="android:statusBarColor">#color/statusBarColor</item>
<item name="android:windowBackground">#color/colorPrimary</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
Either make the AppBarLayout have a solid background or set its app:elevation="0dp" (not android:elevation).
Note: Why do you set every color to colorPrimary is puzzling. Purple text over purple background is not going to work. It also makes it impossible to know where the appbar layout ends and the activity background begins in the screenshot.

Toolbar overlapping below status bar

I want to have appcompat v21 toolbar in my activity. But the toolbar I'm implementing is overlapping below status bar. How can I fix it?
Here is the activity layout xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<FrameLayout
android:id="#+id/container"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
Toolbar view:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
Theme style:
<style name="AppTheme" parent="MaterialNavigationDrawerTheme.Light.DarkActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
</style>
Use android:fitsSystemWindows="true" in the root view of your layout (LinearLayout in your case).
Just set this to v21/styles.xml file
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
and be sure
<item name="android:windowTranslucentStatus">false</item>
For me, the problem was that I copied something from an example and used
<item name="android:windowTranslucentStatus">true</item>
just removing this fixed my problem.
None of the answers worked for me, but this is what finally worked after I set:
android:fitsSystemWindows="false"
In parent activity layout file it's not suggested at many places but it's work for me and saves my day
None of the answers worked for me, but this is what finally worked after i set android:fitSystemWindows on the root view(I set these in styles v21):
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">false</item>
Make sure you don't have the following line as AS puts it by default:
<item name="android:statusBarColor">#android:color/transparent</item>
I removed all lines mentioned below from /res/values-v21/styles.xml and now it is working fine.
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="android:windowDisablePreview">true</item>
<item name="windowNoTitle">true</item>
<item name="android:fitsSystemWindows">true</item>
According google docs ,we should not use fitsSystemWindows attribute in app theme, it is intended to use in layout files. Using in themes can causes problem in toast messages .
Check Issue here & example of problem caused here
<item name="android:fitsSystemWindows">true</item>
Example of using correct way and which works fine with windowTranslucentStatus as well.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="#layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</include>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="#color/white"
android:animateLayoutChanges="true"
app:headerLayout="#layout/navigation_drawer_header"
app:menu="#menu/navigation_drawer_menu" />
</android.support.v4.widget.DrawerLayout>
Remove below lines from style or style(21)
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
<item name="android:windowTranslucentStatus">false</item>
There are so many reason to happen this.. firstly you must check your them how it was going on..
<style name="AppTheme" parent="BaseAppTheme">
<item name="android:windowBackground">#android:color/white</item>
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
<item name="android:textColorHint">#color/secondary_text</item>
</style>
if you use <item name="android:windowTranslucentStatus">true</item> this code in your theme it should be overlap your action bar. you can use it false for solving this problem.
<item name="android:windowTranslucentStatus">false</item>.
or if you want to keep it as true please use
<item name="android:fitsSystemWindows">true</item> as true. You have another option to use this. you can use android:fitsSystemWindows="true"
this inside the root view of particular xml file.
To prevent the Toolbar from overlapping the status bar, add these lines to your theme
<item name="android:fitsSystemWindows">true</item>
<item name="android:windowTranslucentStatus">true</item>
it worked for me

Categories

Resources