Android Alert对话框空白白色背景
问题描述:
我已经在我的应用程序中实现了BaseActivity模式,除了尝试显示警报对话框时,一切都很好。这是发生了什么Android Alert对话框空白白色背景
当我尝试取消对话框我留下了这一点。
下面是用于示出驻留在基底活动对话框中的代码:
new AlertDialog.Builder(this)
.setTitle("Logging out")
.setMessage("Are you sure?")
.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
UIUtils.setAnimation(swipeRefreshLayout, true);
UserBaas.logoutUser();
}
})
.setNegativeButton("No", null)
.show();
此问题是持续在一个仿真器与在实际设备上。可能是什么问题?
switch (item) {
case NAVDRAWER_ITEM_HOME:
startActivity(new Intent(this, MainActivity.class));
break;
case NAVDRAWER_ITEM_MEMOS:
intent = new Intent(this, MemoGroupActivity.class);
intent.putExtra("section", MemoGroupActivity.MEMO);
createBackStack(intent);
break;
case NAVDRAWER_ITEM_GROUPS:
intent = new Intent(this, MemoGroupActivity.class);
intent.putExtra("section", MemoGroupActivity.GROUP);
createBackStack(intent);
break;
case NAVDRAWER_ITEM_CONNECTIONS:
createBackStack(new Intent(this, ConnectionsActivity.class));
break;
case NAVDRAWER_ITEM_DOCUMENTS:
createBackStack(new Intent(this, DocumentsActivity.class));
break;
case NAVDRAWER_ITEM_SETTINGS:
createBackStack(new Intent(this, SettingsActivity.class));
break;
case NAVDRAWER_ITEM_LOGOUT:
showLogoutDialog();
break;
}
而且继承人的UIUtils.setAnimation()
public static void setAnimation(SwipeRefreshLayout swipeRefreshLayout, boolean value) {
swipeRefreshLayout.setEnabled(value);
swipeRefreshLayout.setRefreshing(value);
}
答
试试这个:
.setNegativeButton(Cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
});
+0
这也没有工作 – Michael
答
试试这个:
AlertDialog.Builder b = new AlertDialog.Builder(Your_Activity_Name.this);
b.setTitle("Logging out");
b.setMessage("Are you sure?");
b.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do something
}
});
b.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
b.create().show();
答
尝试这样.:
.setNegativeButton(Cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
});
所以你的问题是UserBaas.logoutUser()不会被调用? –
不,问题是背景是空白的,即使在对话框消失后它仍然是空白的。 – Michael
一次尝试相同的活动,而不是使用BaseActivity。 –