[英]Android - alert dialog appears momentarily than turns black
I'm using a list view and the following code to show an alert dialog:我正在使用列表视图和以下代码来显示警报对话框:
exerciseListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
new AlertDialog.Builder(absActivity.this).setView(R.layout.layout_dialog)
.setTitle("are you sure?").
setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}).setNegativeButton("No", null).show();
return true;
}
});
}
The alert dialog appears momentarily like this:警报对话框会立即出现,如下所示:
than immediately disappears and turns:然后立即消失并转身:
Apperantly the problem was in the emulator, after wiping the phone's data the problem was solved.显然问题出在模拟器上,擦除手机数据后问题就解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.