Animations in Android

Source: Internet
Author: User

Animations in android fall into two main categories: View Animation and Property Animation. View animations are also divided into frame animations (frame Animation) and motion tweens (Tween)

View Animation: Animate an animation without altering the property properties of the control itself: to animate effects change the properties of the control itself

Frame animation: The implementation of frame animation, first put the animation resources in the Drawable folder (a animation-list tag XML file, which is one item),

Then on the code, the first step: Get the control to show the animation effect, step two: Set the background of the control as an animation resource file (using the Setbackgroundresource method), step three: Use Getbackground () Converts the control to a Animationdrawable object. The methods for starting and pausing animations are: Start (), Stop ()


Motion Tweens: Tween animations are divided into four types: fade in (Alpha), pan (translate), scale, rotation (rotate). There is, of course, a set, which can contain a variety of effects. It is not difficult to achieve tweened animation, in terms of code, just a word, such as imageview.startanimation (Animationutils.loadanimation (This,r.anim.alpha_main));

Resources is the XML file, to achieve what effect is what label, such as to achieve the effect of fading is alpha tag, the specific point is not detailed, very simple.


Property Animation: First to point out the property animation. The main use of the class has: Objectanimator,animatorinflater, the need for animation resources is a property animation resource XML file, specifically I will not say. The code is very simple, a few lines of code is done, such as: Objectanimator Objectanimator = Animatorinflater.loadanimator (this,r.animator.object_         background); Objectanimator.settarget (TV);//Set the control that currently uses the property animation Objectanimator.start ();//Start Property animation




Animations in Android

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.