开发者

AlertDialog buttons always close the dialog once clicked

开发者 https://www.devze.com 2023-02-07 19:06 出处:网络
I\'m using an AlertDialog with 2 buttons (one positive, one negative). I\'ve set a handler for those buttons which doesn开发者_JAVA技巧\'t mention dismiss. Indeed after clicking, I don\'t want the dia

I'm using an AlertDialog with 2 buttons (one positive, one negative). I've set a handler for those buttons which doesn开发者_JAVA技巧't mention dismiss. Indeed after clicking, I don't want the dialog to close. However, it seems that as soon as we click on a positive/negative button on an AlertDialog, it always get closed.

Is there a way to prevent the dialog from closing after clicking on any button ?

Thanks,

Vincent


Use custom layout for Dialog and you will be happy!


Use a custom dialog, not an AlertDialog.


You can also create a new Activity and assign it the theme dialog in your manifest with

<activity android:name="MyDialogActivity" android:theme="@android:style/Theme.Dialog" />
0

精彩评论

暂无评论...
验证码 换一张
取 消