全屏显示

作者:追风剑情 发布于:2016-8-18 13:11 分类:Android

Android 3.0(API level 11)
STATUS_BAR_HIDDEN 遮挡但不移除手机的导航栏和平板电脑的系统栏
STATUS_BAR_VISIBLE 显示导航栏和平板电脑的系统栏
view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);

Android 4.0(API level 14)
SYSTEM_UI_FLAG_LOW_PROFILE 遮挡住导航按钮
SYSTEM_UI_FLAG_HIDE_NAVIGATION 在手机上移除导航栏,并遮挡平板电脑的系统栏中使用的导航按钮
隐藏导航栏
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
隐藏状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

//监听导航的可见性变化
view.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener(){
	@Override
	public void onSystemUiVisibilityChange(int visibility) {
		if(visibility == View.SYSTEM_UI_FLAG_VISIBLE){
			//显示操作栏和状态栏
			Toast.makeText(LoginActivity.this, "显示操作栏和状态栏", Toast.LENGTH_SHORT);
		}else{
			//隐藏操作栏和状态栏
			Toast.makeText(LoginActivity.this, "隐藏操作栏和状态栏", Toast.LENGTH_SHORT);
		}
	}
});


 

标签: Android

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号