Removing shade from status bar in dialogfragment when using android:windowTranslucentStatus - android

So I want to be able to show fullscreen dialog with status bar on top of it (dialog itself being behind the status bar). But I can't seem to find a way to do this.
I cannot use
dialog.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN);
Because it makes status bar dissapear completely.
If I try to use:
<item name="android:windowTranslucentStatus">true</item>
I am able to go below status bar, but status bar is still grey (I believe it uses some level of transparency to darken the content behind)
This option doesn't work when combined with android:windowTranslucentStatus:
<item name="android:statusBarColor">#color/transparent</item>
Content doesn't go behind status bar if I use:
android:fitsSystemWindows="true"
My content goes behind navigation bar if I use this:
setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
So how do I achieve what I want?

Related

In Android How To Make Translucent Status Bar With Black Background Navigation Button

Guys I want to have translucent status bar with black background navigation buttons. Just like Netflix App as shown in picture. I tried really hard to find any way but I failed to achieve this. Any Idea?
Add in styles.xml in Base Application style
Change status bar color : <item name="android:statusBarColor">#color/blackColor</item>
For Translucent status bar : <item name="android:windowTranslucentStatus">true</item>
For navigation bar color : <item name="android:navigationBarColor">#color/blackColor</item>
in layout file use : android:fitsSystemWindows="true" in root layout.

Translucent navigation bar

I want to have the content of my layout being displayed under the navigation bar (also called translucent navigation bar). After reading on the internet, it says all you have to do is add this 2 items to style applied to the activity:
<item name="android:navigationBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
The result is, that the navigation bar is light gray and not transparent. How do all the people solve this ?
Problem was the attribute
android:fitsSystemWindows="true"
in the root view of my layout (in this time CoordinatorLayout). This attribute prevents the content of the layout to draw behind the status and navigation bar.

Android - Fully transparent status bar with non transparent navigation bar

I have been looking for a way to re-color the navigation bar while the status bar is fully transparent (not translucent).
Getting the status bar to be completely transparent requires the layout flags to be set to NO_LIMITS but that also makes the navigation bar lose its color. Is there any way to achieve this?
If you do not need the status bar text to be dark, the following works.
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
And change the navigation bar color as #JaviChaquƩs suggest.
You can set this:
<item name="android:navigationBarColor">#color/your_color</item>
<item name="android:statusBarColor">#color/your_color</item>

Customize the part on top of the action bar

I'd like to know what's the name of the part on top of the action bar (where the time is displayed alongside the battery, wifi, etc), and how can its color be changed ?
Thanks !
That's the status bar.
Just add colorPrimaryDark item to your theme in styles.xml
<item name="colorPrimaryDark">#color/primary.dark</item>

transparent statusbar navigationdrawer after setstatusbarcolor

I'm try to developing an app with a navigation drawer from a template found on github.
In style.xml i have:
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#ff0000</item>
<item name="colorPrimaryDark">#0000ff</item>
and the status bar in navigation drawer is ok.
When i click the button it runs this command:
getWindow().setStatusBarColor(Color.GREEN);
Now the status bar color in navigation drawer is no more translucent
How restore status bar color to translucent?
The difference is that the xml defined colors colorPrimary and colorPrimaryDark are not really used to directly set the status bar color.
Actually the statusbar is completely transparent all the time and only the underlaying View is colored. Thats why it can have another color on the left than on the right side (have a look at your second screenshot). If you now call getWindow().setStatusBarColor(..) you indeed color the statusbar directly and over-draw the color of both Views. So it needs to stay transparent!
What you really want to do, is changing the color of the View underlaying the status bar, which is done with the ScrimInsetsFrameLayout class.
Have a look at this question and this class from the library you provided
There you should find all the necessary information to change only the color of the area you want to.
In case you really just want to reset the color:
getWindow().setStatusBarColor(Color.TRANSPARENT);

Categories

Resources