2015-09-02 8 views

ответ

0

Это возможно только с андроид 5.0+, и вы просто нужно использовать правильную тему и параметры

Создайте или измените свой theme.xml и примените тему к вашему приложению в манифесте, и, конечно же, вы также должны определить свой собственный цвет.

значения/themes.xml:

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> 
    <!-- colorPrimary is used for the default action bar background --> 
    <item name=”colorPrimary”>@color/my_awesome_color</item> 

    <!-- colorPrimaryDark is used for the status bar --> 
    <item name=”colorPrimaryDark”>@color/my_awesome_darker_color</item> 

    <!-- colorAccent is used as the default value for colorControlActivated, 
     which is used to tint widgets --> 
    <item name=”colorAccent”>@color/accent</item> 

    <!-- You can also set colorControlNormal, colorControlActivated 
     colorControlHighlight, and colorSwitchThumbNormal. --> 

</style> 

http://android-developers.blogspot.hk/2014/10/appcompat-v21-material-design-for-pre.html

-1

colorPrimaryDark в леденец представляет STATUSBAR цвет

<style name="BaseAppTheme" parent="Theme.AppCompat.Light"> 
    <item name="colorPrimary">@color/main_theme</item> 
    <item name="colorPrimaryDark">@color/main_theme_dark</item> 
    <item name="colorAccent">@color/main_theme_accent</item> 
    <item name="android:textColor">@color/main_theme_text_color</item> 
</style> 

Вы также можете использовать

item name="android:statusBarColor" 

И в Java

 getWindow().setStatusBarColor(Color.argb(40, 0, 0, 0)); 
Смежные вопросы