Issue
Before my app was with android:targetSdkVersion="14" but i decide to make it a little more modern and update it to android:targetSdkVersion="22". However now i have a little problem, the color of the top status bar during the launch phase is now gray (like on the picture) and i would prefer to have it black (like it's was before).
Any idea what i need to do to have my status bar black again during the launch phase ?
NOTE
I would like to change the color of the statusbar via the styles.xml. actually i try to add
<item name="android:colorPrimaryDark">@android:color/black</item>
or
<item name="android:statusBarColor">@android:color/black</item>
didn't help! this question is not a duplicate of other because i can set the StatusBar color to be black without any problem after the app is launched or fully loaded. I need to setup the black background for the statusbar during the launching phase, i mean when user click on the icon of the app their is something like a launch screen (with a define to be black via <item name="android:windowBackground">@android:color/black</item>
) but the statusbar color of this launch sreen is gray (only if android:targetSdkVersion="22")
Solution
The Easiest Way is :got to res -> value -> styles and add this
1: Add this in your color xml file
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#FF4081</color>
</resources>
2:Add this in your styles.xml file
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Note:
- colorprimary is for Actionbar
- colorPrimaryDark is for Statusbar
- your can change these colors and u could get ur required result .
OUTPUT :
hope answerd the question if its useful then vote up
Answered By - Abubakar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.