简体   繁体   中英

How to colour the notification tray on Android?

As you can see on the desing screen shot I have a tabLayout coloured in magenta. But the top notification gtray from the system is still black, where the antenna signal is. 在此处输入图片说明

Can I make the black notification tray in the same color I made the tabLayout?

In Android Lollipop have ability to change the color of status bar in your app for a more immersive user experience and in tune with Google's Material Design Guidelines.

window.setStatusBarColor method introduced in API level 21

Programatically

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.BLUE); }

style.xml

<resources>
   <!-- Base application theme. -->
   <style name="AppTheme" parent="Theme.AppCompat.Light">
       <item name="colorPrimary">@color/color_primary</item>
       <item name="colorPrimaryDark">@color/color_secondary</item>
       <item name="colorAccent">@color/color_accent</item>
       <item name="android:statusBarColor">@color/color_primary</item>
   </style>
</resources>

在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM