如何配置 Android 模拟器以像新 Galaxy Nexus 一样显示屏幕按钮?
我想将我的应用程序转换/适应 Android 4.0。 为此,我计划在支持 ActionBar 的设备上使用它。 所有 Android 版本 >= 3.0 都这样做。此外,没有硬件菜单按钮的设备似乎会自动在操作栏上显示“菜单”按钮。
当我使用 API 级别 13 在模拟器上测试我的应用程序时,它确实按预期工作...... ...但不知何故,我无法将模拟器设置为在模拟 API 级别 14 (Android 4.0) 上的手机时以相同的方式运行。 当我尝试将“硬件后退/主页键”设置为false时,根本没有没有按钮(不在屏幕上,也不提供键盘)由模拟器)。
我在“Galaxy Nexus”的一些屏幕截图和视频中看到,它在 ActionBar 上也显示了一个“菜单”按钮......就像 Honeycomb 平板电脑一样,但不知怎的,我没有成功地对模拟器,这使得理解我的 UI 在 Andoid 4.0 手机上如何工作变得有点复杂。
I would like to convert/adapt my application to Android 4.0.
To do so I plan to use the ActionBar on devices that support it.
All Android version >= 3.0 do so. Furthermore devices that do not have a hardware menu button seem to show an "menu" button on the actionbar automatically.
When I test my application on the emulator using API level 13 this does work as expected...
... but somehow I'm not able to setup the emulator to behave the same way while emulating a phone on API level 14 (Android 4.0).
When I try to set "Hardware Back/Home keys" to false there are no buttons at all (not on the screen and not keypad provided by the emulator).
I have seen on some screenshots and videos from the "Galaxy Nexus" that it is showing an "menu" button on the ActionBar as well ... like Honeycomb tablets do it, but I'm somehow not successful to do the same with the emulator which makes it a bit more complicated to understand how my UI will work on Andoid 4.0 phones.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
最新更新的 SDK (R16) 似乎已解决该问题。
只需将您的 SDK 和 ADT 更新到 R16 并使用更新的 Android 4.0 系统映像创建一个新的模拟器即可。
It seems the issue was fixed with the latest update of the SDK (R16).
Just update your SDK and ADT to R16 and create a new emulator using the updated Android 4.0 system image.
当我将
hw.mainKeys
设置为no
时,软键出现了:$HOME/.android/avd/YOURS.avd/config.ini< /code>
hw.mainKeys=no
(这已在删除的答案中介绍过;不要't知道为什么被删了。)
The soft keys showed up for me when I set
hw.mainKeys
tono
:$HOME/.android/avd/YOURS.avd/config.ini
hw.mainKeys=no
(This was covered in a deleted answer; don't know why it was deleted.)
当您创建新的模拟器时,会有网格硬件,您可以在其中添加选项硬件主页和后退按钮和硬件键盘。因此,创建新的模拟器并查看您的“Galaxy Nexus”:)
不幸的是,您无法更改现有模拟器的此属性。
When you create new emulator there is grid Hardware, and there you can add options Hardware home and back buttons and Hardware keyboard. So, create new emulator and look at your "Galaxy Nexus" :)
Unfortunately you can't change this properties for existing emulator.
升级到 R16 后,如果我使用 WXGA720 分辨率创建模拟器,我只能显示屏幕按钮。
这是我完整的 config.ini 文件:
希望这对某人有帮助。
After upgrading to R16 I could only get the on-screen buttons to appear if I created an emulator using the WXGA720 resolution.
Here is my complete config.ini file:
Hopefully this helps someone.
如果您的应用程序包含响应菜单按钮的功能,则菜单按钮将添加到黑色底栏。
如果您在模拟器中无法看到这一点,您可以通过将其设置为平板电脑分辨率(我使用 1280x800)并观察菜单按钮的行为来解决这个问题,因为它应该与手机版本上的相同。
If your application includes functionality that would respond to a menu button, the menu button will be added to the black bottom bar.
If you are having trouble seeing this in the emulator, you can do a bit of a workaround by setting it to a tablet resolution (I use 1280x800) and observing your menu button behavior there, as it should be the same as on the phone version.