uniapp 对 系统的控制,全屏,系统虚拟键盘,手机导航,强制横屏

// 安卓沉浸式 0关闭 1安卓状态栏导航栏都进入沉浸模式 2设置状态栏沉浸 3设置导航栏沉浸  
function windowFull(pr) { var main = plus.android.runtimeMainActivity(); var windowMe = main.getWindow(); plus.android.importClass(windowMe); var decorView = windowMe.getDecorView(); plus.android.importClass(decorView); var View = plus.android.importClass("android.view.View"); if (pr === 1) { decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } else if (pr === 2) { decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } else if (pr === 3) { decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } else if (pr === 0) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } }



plus.navigator.setFullscreen(true);

 

// #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary');
// #endif
//锁定屏幕方向可取以下值: "portrait-primary": 竖屏正方向;
//"portrait-secondary": 竖屏反方向,屏幕正方向按顺时针旋转180°;
//"landscape-primary": 横屏正方向,屏幕正方向按顺时针旋转90°;
//"landscape-secondary": 横屏方向,屏幕正方向按顺时针旋转270°;
//"portrait": 竖屏正方向或反方向,根据设备重力感应器自动调整;
//"landscape": 横屏正方向或反方向,根据设备重力感应器自动调整;

你可能感兴趣的:(uniapp 对 系统的控制,全屏,系统虚拟键盘,手机导航,强制横屏)