public void showNeoDialog(boolean isReboot, String reason) {
Dialog powerPressDialog = new Dialog(mContext, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
Window window = powerPressDialog.getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.getAttributes().systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
window.clearFlags(
WindowManager.LayoutParams.FLAG_DIM_BEHIND | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
powerPressDialog.getWindow().setBackgroundDrawableResource(com.android.systemui.R.color.volume_high_bak2);//背景颜色透明度
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(com.android.systemui.R.layout.neo_shutdown_progress_dialog, null);
TextView offTV = view.findViewById(com.android.systemui.R.id.shutdown_text);
offTV.setText(R.string.shutdown_progress);
if (isReboot) offTV.setText(R.string.reboot_to_reset_message);
ImageView progressImage = view.findViewById(com.android.systemui.R.id.shutdown_progressbar);
((Animatable) progressImage.getDrawable()).start();
powerPressDialog.setContentView(view);
powerPressDialog.setCancelable(false);
powerPressDialog.show();
}
简单的Dialog,全屏,背景透明度
最新推荐文章于 2020-06-01 16:55:43 发布