Home > Mobile >  RecyclerView scroll to bottom
RecyclerView scroll to bottom

Time:01-18

I want to write a Xamarin.UITest that scrolls my RecyclerView to the bottom and taps on the last item in the list. How can I do this?

CodePudding user response:

I figured it out by setting a view in the last item in my RecyclerView ContentDescription="isLast". Then in my test:

app.ScrollDownTo("isLast", "rvId", ScrollStrategy.Gesture, 0.67, 5000, true, TimeSpan.FromSeconds(30));
app.Tap(c => c.Marked("isLast"));

Where rvId is the ID of the RecyclerView. For example, I have a TextView in each item of my RecyclerView, so I set the last one to MyTextView.ContentDescription="isLast" in my RecyclerView.Adapter

  • Related