问题描述
有没有一种标准的方式来添加一个页脚到上下文菜单,我在其中可以添加一个复选框,以使所选择的选项默认的?类似的,当选择的默认主屏幕例如出现的上下文菜单中。
Is there a standard way to add a footer to a context menu, in which I can add a checkbox to make the selected option the default one?Similar to the context menu that comes up when choosing the default home screen for example.
从API文档文本菜单我看到,你可以设置一个标题视图,而不是一个页脚视图。另外, setCheckable
/ setGroupCheckable
方法似乎没有多大帮助这里。
From the Api docs for ContextMenu I see that you can set a header view, but not a footer view. Also the setCheckable
/ setGroupCheckable
methods don't seem to help much here.
这是否需要通过定制(警报)对话框做了什么?我会想,如果还没有人开发了这样的成分但在情况下,它不可能通过标准的SDK API。任何独立的开源组件了吗?
Does this need to be done via a custom (alert) dialog? I would be wondering if nobody has yet developed such a component yet in case it's not possible through the standard SDK api. Any standalone open source component out there (beside the Android source itself)?
推荐答案
我已经出来是使用最好的 AlertDialog
The best I've come up with is using an AlertDialog
alert.getListView()addFooterView(...);
并重写它的 onItemSelected
方法
这篇关于文本菜单与页脚视图(添加复选框'使默认“选项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!