开发者

ContextMenu with footer view (to add checkbox for 'make default' option)

开发者 https://www.devze.com 2023-01-23 16:18 出处:网络
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?

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.

ContextMenu with footer view (to add checkbox for 'make default' option)

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 itse开发者_如何转开发lf)?


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

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

0

精彩评论

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

关注公众号