Android模拟器不接受键盘输入 - SDK工具rev 20

本文翻译自:Android emulator doesn't take keyboard input - SDK tools rev 20

I've upgraded the SDK tools to revision 20 (from 18) and since the upgrade, the emulator doesn't seem to accept input from laptop's keyboard. 我已经将SDK工具升级到版本20(从18开始),并且自升级以来,模拟器似乎不接受来自笔记本电脑键盘的输入。 But only using the emulator's own 'soft' keyboard (that appears when an input field is focused). 但只能使用模拟器自己的“软”键盘(在输入场聚焦时出现)。

I've tried reinstalling the SDK tools (and the whole SDK for that matter), uninstalled and reinstalled Eclipse Android plugins, re-created emulator devices. 我已经尝试重新安装SDK工具(以及整个SDK),卸载并重新安装Eclipse Android插件,重新创建模拟器设备。 But none of that seem to help and its driving me mad. 但这些似乎都没有帮助,它让我发疯。 Its hopeless to key-in using a laptop's trackpad. 无望使用笔记本电脑的触控板进行键入操作。

Has anyone encountered this problem? 有谁遇到过这个问题?


#1楼

参考:https://stackoom.com/question/l8pe/Android模拟器不接受键盘输入-SDK工具rev


#2楼

Look for the hidden .android folder in your user home folder. 在用户主文件夹中查找隐藏的.android文件夹。 You might rename or delete this folder, recreate your AVD, and restart the emulator. 您可以重命名或删除此文件夹,重新创建AVD,然后重新启动模拟器。 It could be there is a .ini file in that folder that has that setting munged. 可能是该文件夹中有一个.ini文件,该文件具有该设置。


#3楼

Look in AVD Manager, select the AVD and click in Edit. 在AVD Manager中查看,选择AVD并单击“编辑”。 In Hardware section: click in "New" and search for "Keyboard support" and add with OK button and set the value to "yes" and save changes with "Edit AVD" 在硬件部分:单击“新建”并搜索“键盘支持”并使用确定按钮添加并将值设置为“是”并使用“编辑AVD”保存更改


#4楼

Update 更新

As of SDK rev 21 the Android Virtual Device Manager has an improved UI which resolves this issue. 从SDK rev 21开始,Android Virtual Device Manager具有改进的UI,可以解决此问题。 I have highlighted some of the more important configuration settings below: 我在下面重点介绍了一些更重要的配置设置:

在此输入图像描述

If you notice that the soft (screen-based) main keys Back , Home , etc. are missing from your emulator you can set hw.mainKeys=no to enable them. 如果您注意到仿真器中缺少软(基于屏幕)的主键BackHome等,则可以设置hw.mainKeys=no来启用它们。

在此输入图像描述

Original answer 原始答案

Even though the developer documentation says keyboard support is enabled by default it doesn't seem to be that way in SDK rev 20. I explicitly enabled keyboard support in my emulator's config.ini file and that worked! 尽管开发人员文档说默认情况下启用了键盘支持,但在SDK rev 20中似乎没有这种方式。我在我的模拟器的config.ini文件中明确启用了键盘支持,这很有效!

Add: hw.keyboard=yes 添加: hw.keyboard=yes

To: ~/.android/avd/<emulator-device-name>.avd/config.ini 要: ~/.android/avd/<emulator-device-name>.avd/config.ini

Similarly, add hw.dPad=yes if you wish to use the arrow-keys to navigate the application list. 同样,如果您希望使用箭头键来导航应用程序列表,请添加hw.dPad=yes

Reference: http://developer.android.com/tools/devices/managing-avds-cmdline.html#hardwareopts 参考: http//developer.android.com/tools/devices/managing-avds-cmdline.html#hardwareopts

On Mac OS and Linux you can edit all of your emulator configurations with one Terminal command: 在Mac OS和Linux上,您可以使用一个终端命令编辑所有模拟器配置:

for f in ~/.android/avd/*.avd/config.ini; do echo 'hw.keyboard=yes' >> "$f"; done


On a related note, if your tablet emulator is missing the BACK/HOME buttons, try selecting WXGA800 as the Built-in skin in the AVD editor: 在相关说明中,如果您的平板电脑仿真器缺少BACK / HOME按钮,请尝试选择WXGA800作为AVD编辑器中的内置皮肤: 在此输入图像描述

Or by manually setting the skin in config.ini: 或者通过在config.ini中手动设置外观:

skin.name=WXGA800
skin.path=platforms/android-16/skins/WXGA800

(example is for API 16) (例如API 16)


#5楼

Confirmed. 证实。 I had the same problem after upgrading to Tools version 20. I had to Edit the AVD to add an option as follows: 升级到Tools版本20后,我遇到了同样的问题。我必须编辑AVD以添加一个选项,如下所示:

  1. From Eclipse, Go to AVD Mananger. 从Eclipse,转到AVD Mananger。
  2. Select the particular AVD and click on Edit 选择特定的AVD并单击“编辑”
  3. Go to the Hardware section, click on New. 转到“硬件”部分,单击“新建”。
  4. Select the Property Name : Keyboard Support 选择属性名称:键盘支持
  5. By default, it is added with a value of 'no'. 默认情况下,它的值为“no”。 Just click on the value column and change it to 'yes'. 只需单击值列并将其更改为“是”。
  6. Click on Edit AVD again. 再次单击“编辑AVD”。

This will add a property hw.keyboard=yes in config.ini file for the AVD. 这将在AVD的config.ini文件中添加属性hw.keyboard = yes。

You also have to set hw.mainKeys = yes 您还必须设置hw.mainKeys = yes


#6楼

Google wanted to give some more headache to the developers. 谷歌希望给开发者带来更多麻烦。

So, what you have to do now is edit your AVD and add "Keyboard Support" for it in the Hardware section and change the value to "Yes" 那么,你现在要做的就是编辑你的AVD并在硬件部分为它添加“键盘支持”并将值改为“是”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值