通过短按按钮打开类似上下文菜单的菜单的最佳实践是什么?

发布于 2024-09-25 22:24:40 字数 390 浏览 0 评论 0原文

我有一个显示“排序”的按钮,当用户正常/短按该按钮时,我希望出现一个包含各种排序选项的菜单。在网上浏览一下,似乎没有直接回答哪种路线被认为是最佳实践。我希望有一个与此类似的菜单:

Sample menu image

带有图标和文本。

例如,单击 Google 地图应用程序中的“图层”按钮。只需单击一下即可打开选项列表。它的顶部有一个标题,每个选项都有图标。 (图标并不是非常重要)

我应该使用上下文菜单吗?如果是这样,我该如何在不长按的情况下做到这一点。它应该是一个旋转器吗?如果是这样,我如何更改外观以使用按钮而不是正常的下拉框。

I have a button that says "Sort" and when a user normal/short presses the button, I want a menu to appear with the various sort options. Looking around online there doesn't seem to be a straight forward answer to which route is considered best practice. I'm looking to have a menu that looks similar to this:

Sample menu image

with icons and text.

For an example, click the Layers button in the Google Maps app. It opens a list of options on a single short click. It has a title at the top and icons for each option. (The icons aren't super crucial)

Should I use a Context Menu? If so, how do I do it without a long press. Should it be a Spinner? If so how do I change the appearance to use a button instead of the normal drop down box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

扬花落满肩 2024-10-02 22:24:40

Spinner 用于状态选择,这听起来就像您想要的那样。用户将从列表中选择一个排序选项,并且存在对用户保持可见的“当前”排序的概念。

对于屏幕截图中的活动选择器之类的内容,Falmarri 对 AlertDialog 的建议是合理的。选择排序和活动选择器之间的区别在于“状态选择”的区别。旋转器具有已为您提供的当前选定项目的概念,对话框更通用。

Spinners are for stateful selection, which sounds like what you want here. The user will select one sort option from a list, and there is a concept of a "current" sort that stays visible to the user.

For something like the activity picker in your screenshot, Falmarri's suggestion of an AlertDialog is reasonable. The difference between choosing a sort and the activity picker is the "stateful selection" distinction. Spinners have a concept of a currently selected item already provided for you, dialogs are more general.

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