Android Intro Animation

Source: Internet
Author: User

Call, busy two days this, find a variety of information, barely realize my function, this also need to improve, threading knowledge not learned how much, get threading UI has a variety of bugs, helpless. Just skip the first one and have time to come back for a moment.

Body ————

  

To implement the start animation, there are two methods, one is defined with an XML file, and the second is implemented in Java.

In the XML animation, there are four basic animations, such as the piece description

More advanced XML animations can be combined using these four types

Please click this: XML animating UI

Method procedures for using XML animations:

The first step is to create a new Anim folder in Res, and then write an XML animation file inside it,

Step two, load the resource file

The model code is as follows, change the back of the r.anin.xxx

Animation animation=animationutils.loadanimation (this, r.anim.fade_in);

Step three, assign an animation to a control

First.startanimation (animation);

Ps:

    1. First is a ImageView
    2. This method will put an error in the thread run () method, I do not understand the threads, so I can not find a solution

In addition, generally we are to add listeners to the animation, define the behavior before the start of the animation, the behavior of the animation after the bad, and the behavior of the end of the animation

The beginning of the animation generally after the jump to the app main screen activity, with intent intent to jump activity

Don't forget to declare an activity in Androidmainfest.

Animation.setanimationlistener (Animationlistener);

After setting the listener method, do not forget

Use the Java method for animating:


The first step, new animation object

Alphaanimation alphaanimation = new Alphaanimation (0.0f, 1.0f);//transparency from 0.0 (fully transparent) to 1.0 (completely opaque)

The above code is to achieve the fade effect, extrapolate, the other here is not much to say

The second step is to set the related properties for the object,

Alphaanimation.setduration (3000);//Set the animation duration to 3salphaanimation.setfillafter (true);//Set the current state after the animation is finished

Of course not only these two properties, but commonly used in these two, other words, Baidu Bar

Step three, assign animations to controls

First.startanimation (alphaanimation);

PS: Parameter is the object name above

Finally, attach reference: Custom Control Trilogy

Android Intro Animation

Related Article

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.