Frame-by-frame animation is similar to a traditional cartoon, but also a bit like a GIF. It is to create several images and display them in sequence.
The animationdrawable class can be used to create a new frame-by-frame animation for a drawable resource. XML can be used to define the animation drawable resource as an external resource in the Res/drawable folder of the application.
The following describes the program and effect:
<? XML version = "1.0" encoding = "UTF-8"?> <Animation-list xmlns: Android = "http://schemas.android.com/apk/res/android"> <item Android: drawable = "@ drawable/H1" Android: Duration = "500"/> <item Android: drawable = "@ drawable/H2" Android: Duration = "500"/> <item Android: drawable = "@ drawable/H3" Android: duration = "500"/> <item Android: drawable = "@ drawable/H4" Android: Duration = "500"/> </animation-List>
<Relativelayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: Tools = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: paddingbottom = "@ dimen/activity_vertical_margin" Android: paddingleft = "@ dimen/plugin" Android: paddingright = "@ dimen/plugin" Android: paddingtop = "@ dimen/plugin" tools: context = ". mainactivity "> <imageview Android: layout_width =" 200dp "Android: layout_height =" 200dp "Android: src =" @ drawable/line_gradient "/> </relativelayout>
Csdn does not know how to upload dynamic graphs. Therefore, it does not need to be uploaded. Experiment on your own ..