Android实现全屏切换功能:
private void fullScreen(boolean isFullScreen) {
if (isFullScreen) {
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(lp);
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} else {
WindowManager.LayoutParams attr = getWindow().getAttributes();
attr.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setAttributes(attr);
getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
本文介绍了如何在Android应用中实现全屏切换功能,通过设置WindowManager.LayoutParams来控制全屏模式和非全屏模式下的应用界面布局。
1万+

被折叠的 条评论
为什么被折叠?



