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

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

去掉状态栏

[html]  view plain  copy
 
  1. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  
  2.         // WindowManager.LayoutParams.FLAG_FULLSCREEN);  

去掉标题栏 
[html]  view plain  copy
 
  1. requestWindowFeature(Window.FEATURE_NO_TITLE);  

沉浸式状态栏

[html]  view plain  copy
 
  1. @Override  
  2. protected void onCreate(Bundle savedInstanceState) {  
  3.      super.onCreate(savedInstanceState);  
  4.      initWindow();  
  5. }  
[java]  view plain  copy
 
  1. private SystemBarTintManager tintManager;  
  2.   
  3.     @TargetApi(19)  
  4.     private void initWindow() {  
  5.         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {  
  6.             getWindow().addFlags(  
  7.                     WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);  
  8.             getWindow().addFlags(  
  9.                     WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);  
  10.             tintManager = new SystemBarTintManager(this);  
  11.             tintManager.setStatusBarTintColor(getColor(R.color.app_main_color));  
  12.             tintManager.setStatusBarTintEnabled(true);  
  13.         }  
  14.     }  

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

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

[html]  view plain  copy
 
  1.     android:fitsSystemWindows="true"  
  2.     android:clipToPadding="true"  

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

你可能感兴趣的:(Android 去掉状态栏 去掉标题栏 沉浸式状态栏 状态栏重叠 布局重叠 SystemBarTintManager systembartint-1.0.4)