如何在带有菜单按钮的设备上强制使用溢出菜单 [英] How to force use of overflow menu on devices with menu button

查看:27
本文介绍了如何在带有菜单按钮的设备上强制使用溢出菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望所有不适合操作栏的菜单项都进入溢出菜单(从操作栏而不是菜单按钮到达的菜单)即使在设备上强>确实有一个菜单按钮.对于用户来说,这似乎比将它们放入单独的菜单列表更直观,因为 ActionBar 的布局无法将它们放在栏上,因此需要用户从触摸(屏幕)交互跳转到基于按钮的交互.

I'd like to have all of the menu items that don't fit into the ActionBar go into the overflow menu (the one that is reached from the Action Bar not the menu button) even on devices that do have a Menu button. This seems much more intuitive for users than throwing them into a separate menu list that requires the user to jump from a touch(screen) interaction to a button based interaction simply because the layout of the ActionBar can't fit them on the bar.

在模拟器上,我可以将Hardware Back/Home Keys"值设置为no"并获得此效果.我已经在实际设备的代码中寻找一种方法来执行此操作,该设备具有菜单按钮但无法正常工作.有人可以帮我吗?

On the emulator I can set the "Hardware Back/Home Keys" value to "no" and get this effect. I've searched for a way to do this in code for an actual device that has a menu button but can't fine one. Can anyone help me?

推荐答案

针对物理菜单按钮的情况进行修改.

Modified to answer for the situation of physical menu button.

这实际上是被设计阻止的.根据Android 设计指南的兼容性部分

This is actually prevented by design. According to the Compatibility Section of the Android Design Guide,

...操作溢出可从菜单硬件键获得.由此产生的操作弹出...显示在屏幕底部."

"...the action overflow is available from the menu hardware key. The resulting actions popup... is displayed at the bottom of the screen."

您会在屏幕截图中注意到,带有物理菜单按钮的手机在 ActionBar 中没有溢出菜单.这避免了用户的歧义,本质上有两个按钮可用于打开完全相同的菜单.

You'll note in the screenshots, phones with a physical menu button don't have an overflow menu in the ActionBar. This avoids ambiguity for the user, essentially having two buttons available to open the exact same menu.

解决跨设备一致性问题:最终,对于用户体验而言,您的应用与同一设备上的所有其他应用的行为一致比它在所有设备上的行为一致更重要.

To address the issue of consistency across devices: Ultimately it's more important to the user experience that your app behave consistently with every other app on the same device, than that it behave consistently with itself across all devices.

这篇关于如何在带有菜单按钮的设备上强制使用溢出菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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