Far*_*an 8 icons alert android dialog
我有一个允许用户删除视频文件的应用程序.当我按下删除按钮时,我正在使用
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
// mycode........
break;
case DialogInterface.BUTTON_NEGATIVE:
// mycode.....
break;
}
}
};
Run Code Online (Sandbox Code Playgroud)
但是这个消息没有我们在Android设备中看到的警告或删除图标.任何人都可以帮助我获取这些图标或使用任何其他可以显示这些图标的警报对话框吗?
Kev*_*Qiu 29
我倾向于使用AlertDialog.Builder,就像他们在官方doc示例中所示
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
//Set your icon here
.setTitle("Alert!")
.setIcon(R.drawable.icon);
AlertDialog alert = builder.create();
alert.show();//showing the dialog
Run Code Online (Sandbox Code Playgroud)
至于你的sdk文件夹/ platforms/android版本#/ data/res/drawable-mdpi里面的实际图标外观
小智 6
要设置默认对话框图标,请使用:
.setIcon(android.R.drawable.ic_dialog_alert)
Run Code Online (Sandbox Code Playgroud)
还有一些图标:
| 归档时间: |
|
| 查看次数: |
25320 次 |
| 最近记录: |