The swiperefreshlayout implemented by Android enters automatic refresh for the first time
Seeing that the Android version almost achieved this effect, I realized it myself.
Let's start with a renderings
Implementation method:
Method 1:
① In the onwindowfocuschanged() method, set the refresh status to true
② Set the refresh status to false after data acquisition
Method 2:
① After calling the mshiperefreshlayout. Measure() method, set the refresh status to true
② Set the refresh status to false after data acquisition
Note: the purpose of the first step of methods 1 and 2 is to set the refresh status to true after the swipererefreshlayout is drawn. Otherwise, in most cases, the swipererefreshlayout refresh ball will not be displayed.
Source code:
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.