Espresso Recyclerview scroll to end

前端 未结 3 1935
梦毁少年i
梦毁少年i 2020-12-31 06:44

I have an Android application which has a RecyclerView with N elements, and when this RecyclerView reaches to end when scrolling, then more elements are added (so, it\'s an

3条回答
  •  既然无缘
    2020-12-31 07:03

    I use the below to scroll to the bottom of my RecyclerView.

    activity = mActivityTestRule.launchActivity(startingIntent);
    
    onView(withId(R.id.recyclerView))
                    .perform(RecyclerViewActions.scrollToPosition(activity.recyclerView.getAdapter().getItemCount() - 1));
    

    You'll then have to use idling resources (or Thread.sleep()) to call this again when more data has loaded.

提交回复
热议问题