Android implements a loadingbar with adhesion effect

preface

During development, we usually need to display a loading before initiating a network request. The general practice is to add loading to the XML layout, and then set visibility in the activity to control the display and hiding of loading. This is very inconvenient to use, because we have to introduce a loading layout for each XML.

Loadingbar solves this problem better

Recently, the designer selected a loading effect drawing on a foreign website. After trying to implement it, although it is a little different from the original drawing, the effect is still good. The difficulty is the realization of adhesion effect. The dots of Bezier curve are killing me.

Effect drawing first:

Example code

Then there is the source code, which is a simple view, which can be used directly in XML.

"Carefully" drew a diagram to explain the code.

Use in code

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for 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
分享
二维码
< <上一篇
下一篇>>