无法在 Android 模拟器中使用键盘
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11316818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to use keyboard in Android emulator
提问by rishiag
I just set up of Android development environment in Ubuntu 12.04. I made an AVD for Android version 2.3.3 and ran my app on it. But I am not able to use my computer's keyboard or keyboard given on the right side of it. What is the reason for this?
我刚刚在 Ubuntu 12.04 中设置了 Android 开发环境。我为 Android 版本 2.3.3 制作了一个 AVD 并在其上运行我的应用程序。但是我无法使用我电脑的键盘或它右侧的键盘。这是什么原因?
My ADT version is 20.0. I was earlier developing on Windows and it was working fine.
我的 ADT 版本是 20.0。我之前是在 Windows 上开发的,它运行良好。
采纳答案by rishiag
回答by Audrius Meskauskas
I have just tested and it still works perfectly. You just need to enable this. And I do not see anything in the AVD documentationthat would show it is no longer supported. Probably they have added the support back.
我刚刚测试过,它仍然可以完美运行。你只需要启用它。而且我在AVD 文档中没有看到任何表明它不再受支持的内容。可能他们已经添加了支持。
AVD settings for the different Android version seem slightly different. For old versions (2.x), add the hardware property "Keyboard support", set the value to yes, as shown here:
不同 Android 版本的 AVD 设置似乎略有不同。对于旧版本(2.x),添加硬件属性“Keyboard support”,设置值为yes,如下图:
For newer versions, there is a checkbox you need to check:
对于较新的版本,您需要选中一个复选框:
I have just tested on my Android development environment (Eclipse, Ubuntu) - for both cases, the keyboard does work inside the emulator.
我刚刚在我的 Android 开发环境(Eclipse、Ubuntu)上进行了测试——对于这两种情况,键盘都在模拟器内工作。
回答by Darkseal
If you're using Eclipse/ADT in Windows 8.1 you have to enable keyboard support by changing this setting:
如果您在 Windows 8.1 中使用 Eclipse/ADT,则必须通过更改此设置来启用键盘支持:
hw.keyboard = yes
which is located in the hardware.ini of your AVD skin. You can find it here:
它位于 AVD 皮肤的 hardware.ini 中。你可以在这里找到它:
<ANDROID_SDK_PATH>\sdk\platforms\android-<APIversion>\skins\<YourSkin>\hardware.ini
Since the default is (for most skins, including Galaxy S2 one which I'm using mostly) set to no.
由于默认设置(对于大多数皮肤,包括我主要使用的 Galaxy S2 皮肤)设置为no。