Super nice drop-down refresh animation Android code implementation

Recently, I've seen a lot of high-end, atmospheric and high-grade animation effects. If you add these animations to your project, I believe your app must be excellent. Today, I'll analyze a super good-looking drop-down animation from yalantis.

First, let's look at the effect:

What about? Is it very tall? Next, let's look at the code:

1、 First, we need to customize the dynamic refreshview of the refresh (that is, the header during the pull-down). 1. Initialize the dimensions occupied by the header

2. Fill in the picture for the head and set the size of the picture as the cloud on the left, the cloud on the right, the cloud in the middle and the plane in the middle. The plane is animated. The animation of the plane will be introduced below

3. Then let's draw this head

The animation effect has been drawn. Let's see how to call it combined with pull-down refresh? 2、 We also need to customize a pulltorefreshview (pull-down refresh). 1. Our pulltorefreshview here needs to inherit the ViewGroup. Let's add the animation during refresh just defined

2. Then we set the ontouchevent() event

3、 Finally, let's see how to use this drop-down refresh control in the activity. 1. First look at the layout file. Here is our drop-down refresh space nested with our listview, and then we can fill the listview with data

2. Fill the listview with data. For our better effect, here we fill each item of the listview with different colors, which will look tall.

3. Finally, let's set the drop-down refresh listening event again, and then it's OK

What about? Are you tall?

You can practice it. I hope it will be helpful to your study.

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