1、新建values-v19 :
<item name="android:windowTranslucentStatus">true</item>在需要实现一体化的布局添加:
android:fitsSystemWindows="true"
2、也可通过代码:
/**
* 设置状态栏背景状态
*/
private void setTranslucentStatus()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
winParams.flags |= bits;
win.setAttributes(winParams);
}
SystemStatusManager tintManager = new SystemStatusManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(0);//状态栏无背景
}
}
3、也可使用开源库SystemBarTint,兼容至api 10