android-layoutanimation animation Effects-Example

Source: Internet
Author: User

Reference Links:

http://blog.csdn.net/imdxt1986/article/details/6952943


Animate a control

1, can be set in the XML file;

2, can be set in Java code.


First, create a new slide_right.xml under the Res/anim folder, as follows:

<set xmlns:android= "http://schemas.android.com/apk/res/android"    android:interpolator= "@android: anim/ Accelerate_decelerate_interpolator ">    <translate android:fromxdelta=" -100%p "android:toxdelta=" 0 "        Android:duration= "@android: Integer/config_shortanimtime"/>   </set>

Then, create a new list_anim_layout.xml under the Res/anim folder, as follows:

<layoutanimation xmlns:android= "http://schemas.android.com/apk/res/android" android:delay= "30%" Android: animationorder= "Reverse" android:animation= "@anim/slide_right"/>

1, set the animation in the XML file;

Add the following configuration directly to the control:

<span style= "FONT-SIZE:18PX;" >android:layoutanimation= "@anim/list_anim_layout" </span>

For example:

<span style= "FONT-SIZE:18PX;" ><textviewandroid:id= "TextView1" android:text= "Mytextview" android:layoutanimation= "@anim/list_anim_layout "></TextView></span>

2. Set in Java code:

Animation anim = animationutils.loadanimation (Getbasecontext (), r.anim.slide_right);    Layoutanimationcontroller lac = new Layoutanimationcontroller (anim);    Lac.setorder (layoutanimationcontroller.order_random);    Lac.setdelay (1); Control name. Setlayoutanimation (LAC)


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

android-layoutanimation animation Effects-Example

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.