如何强制使用溢出菜单上的菜单按钮装置菜单、按钮、装置

2023-09-11 10:58:47 作者:甜度超标

我想所有的菜单项不适合的动作条进入溢出菜单的甚至是做有一个菜单按钮的。这似乎更直观的用户比把它们放在一个单独的菜单列表,要求用户从触摸(屏幕)的互动,基于按钮的交互跳只是因为动作条的布局不能在酒吧适合他们。

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.

在模拟器我可以设置硬件返回/主页键的值改为无,并获得这样的效果。 我已经寻找一种方式来做到这一点在$ C $下,有一个菜单按钮的实际设备,但不能罚款之一。谁能帮我?

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.

这是实际上是由设计pvented $ P $。按照 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."

您会注意到,在屏幕,手机与物理菜单按钮没有在动作条溢出菜单。这避免了多义性对于用户来说,基本上具有两个按钮可用来打开完全相同的菜单

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.