Android development modification status bar background color and icon color example

This paper introduces an example of Android development modifying the background color and icon color of the status bar, which is shared with you as follows:

Modify the status bar background color and icon color

The default is white on a black background. Now we want to change it to black on a white background

First look at the renderings:

1. Status bar background is white: set in style

2. Write and modify the color of the status bar icon (only black and white are known for the time being)

The code above is https://www.oudahe.com/p/38718/ Find it on the website. You can go and have a look

3. The specific reference columns are in baseactivity

4. The normal status bar has changed

The status bar is changed, but you will see that the whole activity layout will move up and fill the whole screen

Solution 1: add in apptheme in style

< item name = "Android: fitssystemwindows" > true < / item > if you add the above code, the layout will move down and will not affect other things. Then you don't have to look down

Android: fitssystemwindows is a mess. There are problems with the style of many pop ups

Solution 2: add paddingtop for each layout yourself

LibUtils:

Place of reference:

Note: libutils.setlayoutpadding is called after setcontentview. Android.r.id.content is the root layout of each layout, which is not understood

Also consider the Android version. Generally, the system under 5.0 still uses the default version

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>