Question

I have a plain simple implementation of SwipeRefreshLayout that has a ListView as its child. The ListView presents a list of comments from a web API (paginated). Each time I load another page from the API, I use the setRefreshing(true) method on the SwipeRefreshLayout, which works as needed, except for the fact that this makes the ListView jump right to the top of the comments, even if you are 2-3+ pages in.

Is this the intended behaviour ? Because I couldn't find any hint about this. If so, is there any workaround in order for the ListView to not jump to the top ?

Was it helpful?

Solution

Looked through the method code of setRefreshing(). It doesn't effect the position of the scrollable child. Then it hit me that I was doing a selection on the list after the API call. So there's nothing wrong with the SwipeRefreshLayout. My bad.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top