2016-08-06 15 views

cevap

9

Kullanım pressImeActionButton() ViewAction burada belgelenen: https://developer.android.com/reference/android/support/test/espresso/action/ViewActions.html#pressImeActionButton()

onView(withId(R.id.search_box)) 
    .perform(pressImeActionButton()); 

Ayrıca, beklenen IME eylem görüntülenir olup olmadığını kontrol etmek için https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#hasImeAction(int) belgelenmiş hasImeAction (int imeAction) kullanabilirsiniz.

0
  1. EditText android:imeOptions="actionSearch" için düzen dosya seti özelliğinde;
  2. Ardından önceki cevabı kullanın:

    OnView (withId (R.id.search_box)) .perform (pressImeActionButton());

İlgili konular