The Android control pullrefreshviewgroup implements pull-down refresh and pull-up loading

This example shares more specific codes for Android to realize pull-down refresh and pull-up loading for your reference. The specific contents are as follows

Share the source code first: Android enables pull-down refresh and pull-up loading. More

Implementation idea: the pullrefreshviewgroup control takes over the sliding of standard controls (such as recyclerview, listview, etc.), calls the internal methods of the standard control for short-distance sliding, and no longer handles events by the standard control itself, but completely handles touch events by the pullrefreshviewgroup control. The sliding distance and other attributes inside the standard control are obtained by three methods: computeverticalscrollextend, computeverticalscrollrange and computeverticalscrolloffset.

The layout of the pullrefreshviewgroup control is as follows

Partial code implementation

Touch slide event handling

Small distance sliding code

Handle the code for small-distance scrolling of standard controls. Listview is a little special here.

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.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>