开发者

What is the best practice for opening a context-menu-like menu from a short button click?

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:

What is the best practice for opening a context-menu-like menu from a short button click?

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 cl开发者_Go百科ick. 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.


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.


http://developer.android.com/reference/android/app/AlertDialog.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜