如何在此自定义对话框上设置按钮的操作?
我制作了一个自定义对话框,如下所示:
public class CustomDialog extends Dialog {
public CustomDialog(String s) {
super(s, new String[] {"View","Cancel"}, new int [] {1,2}, 1, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.FOCUSABLE);
}
如何为“查看按钮”和“取消按钮”设置操作? 我搜索了但没有找到我必须做的事情。 请帮我 !
I make a custom Dialog like as :
public class CustomDialog extends Dialog {
public CustomDialog(String s) {
super(s, new String[] {"View","Cancel"}, new int [] {1,2}, 1, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.FOCUSABLE);
}
How can I set action for "View button" and " Cancel button " ?
I searched and not found what I have to do .
Please help me !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
Dialog.setDialogClosedListener()
将DialogClosedListener
附加到您的CustomDialog
。当有人单击任一按钮时,将调用DialogClosedListener.dialogClosed()
方法,并且按钮索引将作为choice
参数传递。Attach a
DialogClosedListener
to yourCustomDialog
usingDialog.setDialogClosedListener()
. When someone clicks either of the buttons, theDialogClosedListener.dialogClosed()
method will be called and the button index will be passed as thechoice
parameter.查看此代码..这可能对您有帮助..
Check out this code.. this might help you..