带有页脚视图的上下文菜单(添加“设为默认”选项的复选框)

发布于 2024-09-30 16:55:04 字数 428 浏览 0 评论 0原文

是否有一种标准方法可以将页脚添加到上下文菜单,其中我可以添加一个复选框以使所选选项成为默认选项? 例如,类似于选择默认主屏幕时出现的上下文菜单。

alt text

从 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.

alt text

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你爱我像她 2024-10-07 16:55:04

我想出的最好的方法是使用 AlertDialog

alert.getListView().addFooterView(...); 并覆盖它的 onItemSelected方法。

The best I've come up with is using an AlertDialog

alert.getListView().addFooterView(...); and overriding it's onItemSelected method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文