是否有可能使在一个AlertDialog不自动关闭对话框按钮? [英] Is it possible to make a button on an AlertDialog that doesn't automatically close the dialog?

查看:138
本文介绍了是否有可能使在一个AlertDialog不自动关闭对话框按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个警告对话框一些复选框一个简单的列表视图。我需要选择添加全选/没有,但你不能调出菜单中的警告对话框了,我想从一个按钮来执行此功能。从我见过的任何类型的按钮(正面,中性和负面的)不顾一切关闭对话框。

那么,这可能吗?如果没有,我有什么办法?我最后的缓解是简单地创建一个新的观点和重建一切。是一个新的视图中的解决方案?


解决方案

  

那么,这可能吗?


不从 AlertDialog 标准按钮,AFAIK。


  

如果没有,我有什么办法?


下面是一些:


  1. 请不要提供全选/无

  2. 请不要使用 AlertDialog ,但用一个对话框为主题的活动

  3. 请不要使用 AlertDialog ,而是用对话框
  4. 的其他一些子类
  5. 您引用的选项(不要使用 setAdapter(),而是建立自己的查看的对话内容)

  6. 请不要在所有使用对话框,而是通过 startActivityForResult一个 ListActivity 启动()(类似于#2,只是不用担心主题)

I have a simple list view with some check boxes in an alert dialog. I need to option to add a select all/none but you can't bring up the menu in an alert dialog, and I want to do this function from a button. From what I've seen any kind of button (positive, neutral, and negative) all close the dialog regardless.

So, is this possible? If no, what alternatives do I have? My last mitigation is to simply create a new view and recreate everything. Is a new view the best solution?

解决方案

So, is this possible?

Not from the standard buttons in AlertDialog, AFAIK.

If no, what alternatives do I have?

Here are some:

  1. Don't offer select all/none
  2. Don't use AlertDialog, but use a dialog-themed activity
  3. Don't use AlertDialog, but use some other subclass of Dialog
  4. Your cited option (don't use setAdapter(), but rather create your own View for the dialog contents)
  5. Don't use a Dialog at all, but a ListActivity started via startActivityForResult() (akin to #2, just without worrying about the theme)

这篇关于是否有可能使在一个AlertDialog不自动关闭对话框按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆