Android设置全屏/屏幕常亮

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_40391500/article/details/89487822
//全屏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WindowManager.LayoutParams attributes = getWindow().getAttributes();
    attributes.systemUiVisibility = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN;
    getWindow().setAttributes(attributes);
}

//常亮
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

猜你喜欢

转载自blog.csdn.net/weixin_40391500/article/details/89487822
0条评论
添加一条新回复