Pull down refresh function of Android wechat terminal

How to handle drop-down refresh on Android and IOS:

In the official account of WeChat, Android and iOS have their own way of expression in the face of drop-down refreshing.

    iOS:

    Android:

So we need to load listeners for the content

Note:

We first need to get the position of our fingers on the screen

If we are just IOS, we only need to obtain the starting position relative to the content. However, since the drop-down in Android is an overall drop-down, the displacement relative to the content is small, which requires the value relative to the position of the screen

For the event executed by the finger while moving, the obtained value is constantly changing. When the deviation from the first obtained value is met, the event refresh is executed. IOS and Android here are tried

What can be obtained here is the position obtained when the finger leaves. However, because Android is an overall drop-down, this refresh is mainly based on the scrolltop () of sliding and scrolling. Android cannot obtain the situation when scrolltop = = 0, so it discards the events executed after the finger sliding (I commented it out and will not write it)

The above is the pull-down refresh function of Android wechat introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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
分享
二维码
< <上一篇
下一篇>>