Android设置全屏/屏幕常亮

//全屏
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);

你可能感兴趣的:(随手笔记,Android)