版本5.0以上,在res/values/styles/Theme中设置属性colorPrimaryDark的颜色
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
PS:(4.4版本)
// 1.设置状态栏透明,经测试在代码里直接声明透明状态栏更有效
WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
// 2.在布局文件中,添加属性 android:fitsSystemWindows=“true”,设置背景色。
(http://www.jianshu.com/p/eae7569d7023)