我使用AppCompatDialog構建對話框界面。如何從對話框中刪除陰影? android
我的目標是當它顯示時刪除對話框視圖周圍的陰影嗎?
這裏是例子的代碼:
private void showWrongLoginPassDialog(String message){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.ad_login_error_title));
builder.setMessage(message);
builder.setPositiveButton(getString(R.string.ad_login_error_positive),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
'AlertDialog對話框= builder.create(); dialog.getWindow()。setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show();' – Blackbelt
you are close) dialog.getWindow()。clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.show(); 這很有幫助) 謝謝! –