Android 去掉状态栏 去掉标题栏 沉浸式状态栏 状态栏重叠 布局重叠 SystemBarTintManager systembartint-1.0.4

Android 去掉状态栏 去掉标题栏  沉浸式状态栏

去掉状态栏

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		// WindowManager.LayoutParams.FLAG_FULLSCREEN);

去掉标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);

沉浸式状态栏

@Override
protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     initWindow();
}
private SystemBarTintManager tintManager;

	@TargetApi(19)
	private void initWindow() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
			getWindow().addFlags(
					WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
			getWindow().addFlags(
					WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
			tintManager = new SystemBarTintManager(this);
			tintManager.setStatusBarTintColor(getColor(R.color.app_main_color));
			tintManager.setStatusBarTintEnabled(true);
		}
	}

使用以上两个方法的最后,都要在主布局中加上,否则标题栏是白色的 或状态栏和布局重叠

布局文件上添加这俩个属性

    android:fitsSystemWindows="true"
    android:clipToPadding="true"

systembartint-1.0.4.jar下载:http://download.csdn.net/detail/menglele1314/9452638


 
  

 
  
 
  

你可能感兴趣的:(Android,开发)