Android:带有图标的选项菜单“更多列表" [英] Android: Optionsmenu 'More-list' with icons

查看:20
本文介绍了Android:带有图标的选项菜单“更多列表"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢 Android 在选项菜单中自动显示许多菜单项的方式,当屏幕上的菜单项太多时,它会显示更多"按钮.我想保持这种方式,但是当您按更多"时弹出的菜单项没有菜单图标.有什么办法可以推翻这个吗?如果没有,当用户单击更多"时如何显示我自己的弹出窗口?我仍然希望 Android 计算出用户屏幕上适合多少个菜单项.

I love how Android automaticly displays a number of menuitems in the options menu and when there are too many for your screen, it displays a 'More' button. I'd like to keep it that way, but the menuitems in the popup that you get when you press 'More' don't have the menuicons. Is there a way that I can overrule this? If not, how can I display my own popup when the user clicks 'More'? I still want that Android figures out how many menuitems fit on the users screen.

非常感谢!埃里克

推荐答案

有什么办法可以推翻这个吗?

Is there a way that I can overrule this?

不,抱歉.溢出菜单与上下文菜单一样,没有图标.

No, sorry. The overflow menu, like context menus, do not have icons.

如果没有,我如何在用户点击更多"时显示我自己的弹出窗口?

If not, how can I display my own popup when the user clicks 'More'?

第 1 步:放入五个菜单项

Step #1: Put in five menu items

第 2 步:放入名为更多"的第六个菜单项,并带有适当的图标

Step #2: Put in a sixth menu item, named "More", with an appropriate icon

第 3 步:当用户点击更多"项目时,做任何你想做的事情(例如,AlertDialog)

Step #3: When the user taps the "More" item, do whatever you want (e.g., AlertDialog)

我仍然希望 Android 计算出用户屏幕上适合多少个菜单项.

I still want that Android figures out how many menuitems fit on the users screen.

目前,规则总是6".由于您知道需要多少菜单项,您可以自行确定是否需要自己实现更多".

At present, the rule is always "6". Since you know how many menu items you want, you can determine for yourself whether you need your own implementation of "More".

随着屏幕尺寸变大,Android 可能会开始支持更多选项菜单选项.但是,在此之前,我们无法预测如何最好地实现您的预​​期目标,或者是否有可能实现.

It is possible that Android will start supporting more option menu choices as screen sizes get bigger. However, until that happens, we have no way of predicting how best to meet your desired goal, or if it is even possible.

这篇关于Android:带有图标的选项菜单“更多列表"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆