Learn Android animation together

With a simple example, this paper briefly describes the simple application of animation in Android development, which is only for learning and sharing.

Android provides a variety of powerful APIs for applying animation to UI elements to enrich the functions and applications of applications.

In the Android framework, animation is mainly divided into three categories [these three animation systems are feasible options, but generally speaking, attribute animation system is the preferred method of use because it is more flexible and provides more functions], as follows:

Use the animation resource file as the background of the image view.

The knowledge points involved in frame animation are as follows:

Frame animation core code

In the drawable directory, add an animation resource configuration file [the animation list node contains item sub nodes. Item has two attributes, Android: drawable = image resource ID, Android: duration = cycle], as follows:

The Java setting code is as follows:

Gap animation, also known as gradient animation, refers to defining the start state, end state, intermediate state, etc., and then other parts are automatically generated by the program to form animation.

The knowledge points involved in the gap animation are as follows:

The core code of make-up animation is as follows:

Attribute animation mainly realizes animation by changing the attributes of objects. It can be extended and has rich functions.

The knowledge points involved in attribute animation are as follows:

The core code of attribute animation is as follows:

Learning without thinking is lost, thinking without learning is dangerous!!!

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