Create and use a frame-by-frame animation

Source: Internet
Author: User

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 ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.