This is my style
<style name="NoActionbar" parent="android:style/Theme.NoTitleBar">
<item name="android:statusBarColor">#1c465d</item>
</style
>
I want to change the splash screen, by remove the actionbar but i realise the default status bar colour is black, I am not able to change the colour of statusbar to green
why is this show?
How can I do it?
您可以通过定义colorPrimaryDark
项目来设置状态栏颜色:
<item name="colorPrimaryDark">#1c465d</item>
As stated above, set the colorPrimaryDark attribute in your style to whatever you like.
<resources>
<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/accent</item>
</style>
</resources>
http://developer.android.com/training/material/theme.html
To do it correctly you should declare your color value in the color.xml, then reference it from the style.
转到〜values / color.xml并替换colorPrimaryDark
<item name="colorPrimaryDark">#1c465d</item>
This way you can set status bar color programatically
if (Build.VERSION.SDK_INT >= 21) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.