1、设置为全屏模式:
在所需设置为全屏模式的逻辑的onCreat()方法中加入以下代码即可:
1 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 2 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 3 }
效果如图(适合有背景图的页面):

2、修改style中AppTheme中状态栏颜色(适合普通页面),如:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#ffffff</item>
<item name="colorPrimaryDark">#f2f2f2</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
效果如图:
