直播平台制作,对底部虚拟键的显示和隐藏
直播平台制作,对底部虚拟键的显示和隐藏
1.隐藏底部虚拟按钮:
/**
* 隐藏虚拟按键
*/
public void goneSystemUi(){
//隐藏虚拟按键
if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) {
View v = getWindow().getDecorView();
v.setSystemUiVisibility(View.GONE);
} else if (Build.VERSION.SDK_INT >= 19) {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
}
2.显示底部虚拟按钮:
/**
* 显示虚拟按键
*/
public void visibleSystemUi(){
//显示虚拟键盘
if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) {
//低版本sdk
View v = getWindow().getDecorView();
v.setSystemUiVisibility(View.VISIBLE);
} else if (Build.VERSION.SDK_INT >= 19) {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
}
以上就是直播平台制作,对底部虚拟键的显示和隐藏, 更多内容欢迎关注之后的文章