Transfer from: http://blog.csdn.net/zuiwuyuan/article/details/50100093
Android uses SystemBarTint to set the status bar color
When working on a project, I found that the status bar of the APP is the default color of the system. I suddenly thought, why other APPs are the color set by myself (it matches the APP itself), so I also want to set the color of the system status bar for my APP , More beautiful. . .
I searched it and found that the original setting status bar actually had a very tall name (all those who don’t understand are tall and tall)-immersive status bar, Android 4.4 began to support immersive status bar, continue to search, found that, There is a very simple open source project-SystemBarTint, which can perfectly support the immersive status bar.
SystemBarTint address: https://github.com/hexiaochun/SystemBarTint
Below, a brief demonstration of how to use the library, first of all, let's look at the effect, there is a picture to have the truth:
1. Introduce class library
Using Android Studio, directly import the library in the build.gradle file:
2. Add a method in Activity:
然后, 在OnCreate()方法中调用applyKitKatTranslucency方法:
3. 在style.xml中,添加系统的样式:
当然了,别忘了在AndroidManifest.xml进行配置主题:
Note: This is necessary, if it is not added, it will cause some page distortion.
In summary, you can easily set the status bar color in the system above 4.4, and you may feel that your APP has become better!