带有页脚视图的上下文菜单(添加“设为默认”选项的复选框)
是否有一种标准方法可以将页脚添加到上下文菜单,其中我可以添加一个复选框以使所选选项成为默认选项? 例如,类似于选择默认主屏幕时出现的上下文菜单。
从 ContextMenu 的 Api 文档中,我看到您可以设置页眉视图,但不能设置页脚视图。此外,setCheckable
/ setGroupCheckable
方法在这里似乎没有多大帮助。
这是否需要通过自定义(警报)对话框来完成?我想知道是否还没有人开发过这样的组件,以防无法通过标准 SDK api 实现。有没有独立的开源组件(除了 Android 源代码本身)?
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.
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.
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出的最好的方法是使用
AlertDialog
alert.getListView().addFooterView(...);
并覆盖它的onItemSelected
方法。The best I've come up with is using an
AlertDialog
alert.getListView().addFooterView(...);
and overriding it'sonItemSelected
method.