在我的应用程序中,我在对话框中显示图像。如果用户按下按钮,则会出现对话框并占据整个屏幕的 80%。背景将变暗,因为这是 Android Dialog 的默认行为。
Dialog dialog = new Dialog(ActQuiz.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
//nothing;
}
});
int width = (int) (getResources().getDisplayMetrics().widthPixels * 0.80);
int height = (int) (getResources().getDisplayMetrics().heightPixels * 0.80);
dialog.getWindow().setLayout(width, height);
ImageView imageView = new ImageView(ActQuiz.this);
String uri = "@drawable/" + info.getInfopicture();
int imageResource = getResources().getIdentifier(uri, null, getPackageName());
Drawable myDrawable = ContextCompat.getDrawable(ActQuiz.this, imageResource);
imageView.setImageDrawable(myDrawable);
new PhotoViewAttacher(imageView);
dialog.addContentView(imageView, new RelativeLayout.LayoutParams(width, height));
dialog.show();
所以我想要实现的是禁用按钮的调光,它在对话框后面可见。
这是可能的还是我只能删除整个背景的调光?