Android customize view to imitate Alipay

There is a function of Alipay on the side of the picture, which is the effect of water ripple after clicking the picture. A similar function is also written today.

The effect is as follows:

Idea:

The radius of several circles is getting larger and larger. This can be achieved by animation scaling and transparent animation

In addition, there are several circles, and then the executed animation has a delay effect. In fact, these animations are executed together. Those who are familiar with attribute animation know that they have provided us with the implementation API of synchronous execution animation and sequential execution animation. Some people will also say that these views are drawing several circles in the OnDraw () method. They may say that I want to inherit the container view to onlayout () In the method, these child views are added to a specific area. Of course, this is also possible. In fact, it is simple to take the picture as the center (the picture ImageView is in the center of the parent view), draw a circle, and specify the width and height of each word view. See the code for details:

Each water ripple

Circular picture:

Layout file:

use:

The above is a function of Android custom view imitation Alipay, which I want to help you. If you have any questions, please leave a message for me. 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
分享
二维码
< <上一篇
下一篇>>