android status turns semi-transparent when android:windowTranslucentStatus is true - android

I'm trying to make my Android APP has its status bar translucent. However, when I set like this:
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
My status bar turns to be semi-transparent with a black color:
But what I really want is that the status bar has the same color with my APP, just like this:
I want to know what's wrong with my APP?
My device is Nexus 5.

It's default behaviour for Android API Level 20+
If you want use completely transparent status bar you should set transparent status bar color:
#android:color/transparent
Your second screenshot with shadow in status bar taken on API Level 19 or less.

Related

Not change the colour of status bar to colorPrimary

Can I prevent the colour of the status bar becoming colorPrimary? I mean, I do not want to change the status bar colour, and leave it as it is (system default). I have searched Google for this, and the answer was hiding the status bar. But I do not want to hide it.
I also do not want to change the primary colour to that of the default colour of the status bar. I need the primary colour as it is for other things. I just do not want it to be applied to the status bar.
I know that was the default behaviour before Lollipop. Is this still possible after Lollipop?
This should work
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">#000000</item>
</style>
In your application theme, set status bar color as below:
<item name="statusBarColor">"YOUR_COLOUR_CODE"</item>

How to modify the status bar in android programming?

I want to set the color of status bar to white and icons such as wifi and battery to black. How can I do this?. I will prefer to do this via using Theme.AppCompat
The color of the status bar can be changed by :
<item name="colorPrimaryDark">your_required_color</item>
From API 21, to change color of status bar without using "colorPrimaryDark" use:
<item name="android:statusBarColor">your_required_color</item>
Since Lollipop. Starting with Android 5.0, the guidelines say:
Notification icons must be entirely white.
Even if they're not, the system will only consider the alpha channel of your icon, rendering them white
Refer this : Android statusbar icons color
But from API 23, to change system status icons to semitransparent black you can use :
<item name="android:windowLightStatusBar">true</item>
Refer this : https://plus.google.com/+RomanNurik/posts/4WBSonAZxt1
You can change your statusBarColor by typing below attribute in your style.xml you need to input this code in your base theme.
<item name="android:statusBarColor">COLOR THAT YOU WANT TO CHANGE</item>

Invert icon color of status bar

I have searched a lot about this but all I have found is how to change status bar color.
I want to invert color of icons in status bar on white background like Soundcloud has done in its mobile application like:
How to do this?
You can do that with the following code. it's just working on v23 API.
In your: values-v23/styles.xml:
<item name="android:windowLightStatusBar">true</item>
Check this link for more information: https://stackoverflow.com/a/30075921/4409113
Or: https://stackoverflow.com/a/33316669/4409113

Change status bar icons tint

In Lollipop we can change the color of status bar background or even make it transparent. Let's suppose I want a light background (#eee). Status bar icons' default color is white, so they would become illegible. Is it possible to make them dark?
It's now possible in Android 6+ using this attr in style.xml:
<item name="android:windowLightStatusBar">true</item>

Android 4.4 translucent Status and Navigation bars style on Android 5.0

On Android 4.4 KitKat you can set the Status and Navigation bars transparent with the android:windowTranslucentStatus and android:windowTranslucentNavigation theme elements, and then below the bars the app window is extended and a gradient is added. However on Android 5.0 Lollipop this has been changed and now instead of the gradient a solid transparent color is added. Android 5.0 offers the new android:statusBarColor and android:navigationBarColor elements under the new Material theme, but when you try to set these elements to #android:color/transparent the app window is not extended, and if you use android:windowTranslucentStatus and android:windowTranslucentNavigation then android:statusBarColor and android:navigationBarColor are ignored.
Am I missing something described on http://developer.android.com/training/material/theme.html#StatusBar?
Set android:windowTranslucentStatus to false and set android:statusBarColor to #android:color/transparent.
Then add code below:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
If you also want the navigation bar to be translucent, set android:navigationBarColor to #android:color/transparent and combine the flag View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION as well.
I didn't experiment on the navigation bar but it will work.
Add below line to your style:
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
To clarify #suckgamony's answer to this question:
Under Lollipop and above, setting android:statusBarColor or android:navigationBarColor to #android:color/transparent will make the Status Bar or Navigation Bar (respectively) completely transparent, unless:
android:windowTranslucentStatus or android:windowTranslucentNavigation is set to true, in which case the Status Bar or Navigation Bar (respectively) is set to the solid transparent color #AxeEffect describes (again, under Lollipop and above);
android:statusBarColor and android:navigationBarColor may only be used with Android version 21 (Lollipop 5.0) or higher. As described in the referred to answer, android:windowTranslucentStatus or android:windowTranslucentNavigation when used with Kitkat provide transparent gradients rather than full transparency.

Categories

Resources