dialog.getWindow()。setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT))无法删除黑色背景

时间:2015-05-19 05:34:39

标签: android dialog

我无法从自定义对话框中删除黑色背景,它在19以及19以下的工作正常api,但它在19中的自定义对话框中显示黑色背景。

请在这里帮我解决这个问题。

Dialog dialog  = new Dialog(DAR_Activity.this);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
LinearLayout linearLayout  = (LinearLayout)getLayoutInflater().inflate(R.layout.dialog_progress, null);
dialog.setContentView(linearLayout);
ProgressBar progressBar1  = (ProgressBar)findViewById(R.id.progress_dialog);

dialog.setCancelable(false);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.setCanceledOnTouchOutside(false);

dialog.show();
dialog.getWindow().setGravity(Gravity.CENTER);

0 个答案:

没有答案