Anyone else experiencing issues with the status bar always being grey since using sdk 26 or 27? I recently updated Android Studio and using 27 as my target sdk and now every Activity that is launched has a grey status bar. I have not changed the styles or themes, yet they are always grey.
Another interesting development is my MainActivity has a navigation drawer there and it has no issues rendering a translucent status over my primary colour. But every Activity I launch from there always has the grey status bar. I am completely lost as to why but I am assuming it's the SDK version since I had no issues before.
Every Activity references this style, which used to work for both the MainActivity and all other Activities:
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
I can fix the grey problem by removing the translucent flag and setting the status bar colour manually in xml. However this now breaks the MainActivity's navigation drawer opening under the translucent status bar (it's just the solid colour). In a perfect world I would want the translucent status bar over my primary colour in all activities.
Any help would be appreciated!
UPDATE: I can confirm the issue manifests itself if I use SDK 27 and update the support dependencies with it. If I go back to SDK 26 versions, the problem seems to go away. Is there something specifically related to 27 that we need to be aware of?
Add this line in your styles.xml(v21):
<item name="android:statusBarColor">@color/PrimaryDark</item>
It may solve your problem.
As I stated in my comment, I was having a similar problem that only started to manifest itself in API27. The status bar isn't specifically grey - it's just transparent.
My particular solution was that the styles.xml
in my values-v21
folder was as follows :-
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
Removing the android:statusBarColor
row fixed the issue for me.
The reason I'm posting this as an answer is that in earlier API versions this iffy line had not affected the status bar - which is probably a separate issue in itself. It seems that that issue has been fixed in API27 which is why the status bar is now appearing transparent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With