如何使用 Espresso 执行 EditText 的 actionDone 事件
How to perform actionDone event of EditText with Espresso
标题中的问题。
我试过类似的方法:
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressKey(KeyEvent.KEYCODE_ENTER));
但是没用。键盘仍然显示并且 TextView.OnEditorActionListener
未被调用。有什么想法吗?
尝试
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressImeActionButton());
我用过KEYCODE_BACK,效果很好。 KEYCODE_ENTER 我的设备 SAMSUNG A70 不工作
onView(withId(R.id.edit_text).perform(ViewActions.pressKey(KeyEvent.KEYCODE_BACK))
标题中的问题。
我试过类似的方法:
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressKey(KeyEvent.KEYCODE_ENTER));
但是没用。键盘仍然显示并且 TextView.OnEditorActionListener
未被调用。有什么想法吗?
尝试
onView(withId(R.id.search_edit_text))
.perform(typeText("some"), pressImeActionButton());
我用过KEYCODE_BACK,效果很好。 KEYCODE_ENTER 我的设备 SAMSUNG A70 不工作
onView(withId(R.id.edit_text).perform(ViewActions.pressKey(KeyEvent.KEYCODE_BACK))