我可以自定义AlertDialog 而不使用自定义对话框?正如我想在对话框上的是或否按钮后显示我的取消按钮。在Android中自定义AlertDialog
-2
A
回答
0
是的,你可以。 在xml中进行自定义布局。然后将您的自定义xml设置为您的警报对话框。
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
final View dialogView = inflater.inflate(R.layout.custom_dialog, null);
dialogBuilder.setView(dialogView);
Button yes = (Button) dialogView.findViewById(R.id.yes);
yes.onClickListenere(......./do what you want);
0
这是没有办法改变按钮的顺序。但是你可以这样做并相应地实现所需的按钮点击事件。
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("");
alertDialogBuilder.setPositiveButton("Cancel",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
alertDialogBuilder.setNegativeButton("Yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
alertDialogBuilder.setNeutralButton("No",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
相关问题
- 1. 在自定义AlertDialog中插入SeekBar(Android)
- 2. 在AlertDialog中自定义ListView
- 3. 自定义AlertDialog
- 4. setContentView,微调框自定义alertdialog在android
- 5. IllegalStateException使用自定义adatper和AlertDialog Android
- 6. 在自定义ListAdapter类中显示AlertDialog
- 7. 在Android中显示自定义AlertDialog,同时捕获异常
- 8. 自定义AlertDialog与它
- 9. 与ListView自定义AlertDialog
- 10. 菜单中的自定义AlertDialog?
- 11. Android:在EditText上的自定义AlertDialog上显示软键盘Focus
- 12. 如何自定义Android AlertDialog中的列表项目
- 13. AlertDialog在android中
- 14. 如何在Android中的AlertDialog中包含自定义标题视图?
- 15. 将图像添加到自定义AlertDialog
- 16. 动态设置自定义AlertDialog内容
- 17. 自定义AlertDialog没有显示
- 18. 我不能解雇自定义alertdialog框
- 19. 安卓:更改自定义AlertDialog背景
- 20. 关闭clicklistener上的自定义alertdialog
- 21. 自定义AlertDialog无法初始化onCreate()
- 22. 自定义AlertDialog与切断角落
- 23. 被忽略的自定义AlertDialog大小
- 24. 自定义列表视图的AlertDialog
- 25. 自定义布局AlertDialog不起作用?
- 26. 自定义AlertDialog添加了View.onClickListener
- 27. 不能在自定义AlertDialog内得到定制AlertDialog一个ImageView的,更新的
- 28. 在android中自定义seekbar
- 29. 具有自定义视图的Android AlertDialog:获取输入数据
- 30. 显示自定义对话框一个Android AlertDialog,点击
告诉我们你的努力 – yuyoyuppe