Android implements a simple pull-down refresh pulltorefresh
There are a lot of demos for online pull-down refresh, but there are always various dissatisfactions. Some pull-down get stuck, some rebound is not smooth, some performance is too low, they get stuck, and some emptyview can't pull-down
What you write is the most suitable for you. The code is very simple and easy to modify. You can change all kinds of effects you need by reading the code a little.
First, rewrite listview and customize touch events. In order to make emptyview drop-down, emptyview also adds touch events. If you want to implement GridView, change the listview here to GridView.
PullableListView :
Then the linearylayer of the outer layer listens to the pull-down callback of the pullablelistview to achieve the pull-down effect. At the same time, external interfaces of listview (GridView) are provided, such as setemptyview (view view), setadapter (listadapter adapter)... And so on. Only some I need to use are provided here. External interfaces can be provided according to my own needs. In the code, r.drawable.pulltorefresh and r.drawable.loading are the pictures of the drop-down arrow and the refresh scroll bar respectively. They are not provided here. Just find two pictures and paste them at will.
PullToRefreshView:
layout-view_ pulltorefresh:
anim-anim_ progressbar:
Finally, demo activity:
layout-activity_ pulltorefresh:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.