I would like to implement the same pull-to-refresh UI pattern used by the Twitter app.
I have been trying to use a RelativeLayout
containing a ListView
, but it's really slow. How can I make it as smooth as Twitter?
I have been using the Listview's onTouch callback to get the MotionEvent
, detecting when the listview is already scrolled to the top and the touch is moving downwards. Then, I adjust the top margin of the listview based on the Y coordinate. But surely that's not the way to do it, as the Listview moves down in little steps, not smoothly.
Do you know which layout should be best used?
Below is just a screenshot from the Twitter app:
UPDATE:
I think I found it. I believe the smoothest implementation is by using the ListView header. So, no need to use a viewgroup like RelativeLayout. Everything could be implemented within the ListView.