如何在 Genymotion 模拟器上测试 IME_ACTION_DONE

How to test IME_ACTION_DONE on Genymotion emulator

在我的一个应用程序中,我有一个设置了 android:imeOption="actionDone"EditText。我还设置了适当的 setOnEditorActionListener().

 <EditText
    android:id="@+id/search_field"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/search_field_hint"
    android:imeOptions="actionDone"
    android:singleLine="true"/>

在真实设备上测试时,一切正常 - 我输入一些文本,点击 "Done" 按钮,我的操作就被触发了。

虽然在 Genymotion 模拟器上(我真的更喜欢在开发时使用)我看不到软键盘,因此我无法单击 "Done" 按钮来触发操作。

如何测试我的 imeOption 是否已设置并且是否在 Genymotion 模拟器上正常工作?

在打开模拟器之前,按模拟器的首选项按钮并选中使用虚拟键盘进行文本输入。这应该可以解决问题,当然您需要按下虚拟键盘。