I'm using the AppCompat-v7:21.0.0
support library for Android 5.0 Lollipop in Android Studio. My problem is that the Status Bar Color that can be changed by setting colorPrimaryDark
in the values/styles.xml
file, is showing up as black, in both the xml layout preview and the emulator.
So what's wrong? Am I missing something? Please let me know. Thanks.
EDIT: I'm aware of the fact that changing the status bar color on Pre-Lollipop versions is not possible. My XML Layout Editor Preview and my Emulator are both set to API Level 21 (5.0 Lollipop). But, the status bar still isn't of the color I set it to in colorPrimaryDark
. I tried doing statusBarColor
in styles.xml
but to no avail. It's still black.
ALSO: I saw one of the answers on a similar question where they advised me to put my minSdkVersion
to 21. I tried that, but it didn't work. And I want my app to run on devices with API Level 15 and above.
Please read this: For this to take effect, the window must be drawing the system bar backgrounds with
android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
but
android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
must not be set (Source)
In case of you don't know how to add that flag:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);