Slide 17
Slide 17 text
ViewInteraction appCompatButton = onView(
allOf(withId(R.id.button_recycler), withText("RecyclerView"),
withParent(allOf(withId(R.id.activity_main), withParent(withId(android.R.id.content)))),
isDisplayed()));
appCompatButton.perform(click());
ViewInteraction recyclerView = onView(allOf(withId(R.id.recycler_view), isDisplayed()));
recyclerView.check(matches(isDisplayed()));
// >>> Developers need write this line to scroll RecyclerView
onView(withId(R.id.recycler_view)).perform(RecyclerViewActions.scrollToPosition(19));
// <<<
ViewInteraction appCompatButton2 =
onView(allOf(withId(R.id.text_recycler), withText("position: 19"), isDisplayed()));
appCompatButton2.perform(click());