Scroll element to top of screen

35 views
Skip to first unread message

John Matthews

unread,
Oct 4, 2023, 1:37:15 PM10/4/23
to Android Testing Support Library
Seems we have every which way to get an element visible but it sets it to the bottom of the screen.  Is there a method that makes it scroll and puts it at the top if possible?  Problem with mine is that the FAB buttons are getting in the way and when the click event happens on the view underneath, it actually clicks the FAB button and not the view I wanted.  

Manuel Garcia

unread,
Apr 10, 2024, 11:47:18 AM4/10/24
to Android Testing Support Library
I think what you are trying to do can be achieved with these 2 lines of code

linearLayoutManager?.setStackFromEnd(false)
linearLayoutManager?.scrollToPositionWithOffset(positionToScroll, 0)

Being linearLayoutManager the LinearLayoutManager set to the RecyclerView 
Reply all
Reply to author
Forward
0 new messages