The XML implementation of the Android learning note-tween Animation

Source: Internet
Author: User

Following the Java implementation of the previous tween animation: http://www.cnblogs.com/fengtengfei/p/3957800.html,

Here I go on to introduce the XML implementation method of tween animation,

First we need in the Res folder in the establishment of the Anim folder, and then in the Anim folder to build the relevant animation XML, and set Zodiac can be.

We then load the XML file with the animationutils.loadanimationin the activity.

Animation Animation = Animationutils.loadanimation (this, r.anim.roatate);

Iv.startanimation (animation);

One of the things to note is:

1: For example, our translate.xml. If we need to move relative to the parent window, we need to add p after 20%, which is 20%p, which indicates the size of the parent window.

<?xml version= "1.0" encoding= "Utf-8"? ><translate xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:fromxdelta=" 20%p "     android:toxdelta=" 50%p "    android:fromydelta=" 0 "    android: Toydelta= "50%p"    android:duration= "></translate>"    

2: We need to mix the definition of animation, we just want to define the animation type corresponding to the XML node, write to the inside of the set node.

Like Set.xml.

<?xml version= "1.0" encoding= "Utf-8"? ><set xmlns:android= "Http://schemas.android.com/apk/res/android" >    <alpha............>    </alpha>............</set>

The XML implementation of the Android learning note-tween Animation

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.