Android frame by frame animation implementation code
Frame by frame animations, as the name suggests, is playing pictures frame by frame, just like playing movies. It can be implemented in XML or Java code. Frame by frame animation is suitable for simple animation effects. If you want to achieve complex animation, it is not recommended to use frame by frame animation.
XML implementation:
Step 1: create a file sample in the RES / drawable directory_ animlist.xml:
The animation list consists of one or more item nodes. The item node is used to declare an animation frame. Drawable: the picture resource duration of the frame: the playback time unit is milliseconds. Oneshot: whether to play it only once. True indicates that it will play it only once, and false indicates that it will play it repeatedly
step 2:
Using ImageView as playback carrier
Step3: initialize, pause and play in activity.
Pure java implementation
Addframe (drawable frame, int duration): add a frame and set the display duration of the frame
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.