Android four simple animations (fade, rotate, move, zoom effect)

Source: Internet
Author: User

Recent animation effects used in Android development.

public void OnClick (View arg0) {
TODO auto-generated method stubs
Switch (Arg0.getid ()) {


Case r.id.danru://Fade

Animationset aset=new Animationset (true);
Alphaanimation aa=new alphaanimation (1,0);
Aa.setduration (2000);
Aset.addanimation (AA);
Btn_danru.startanimation (Aset);
Break


Case r.id.yuanzhuan://Rotation effect
Animationset aset_2=new Animationset (true);
Rotateanimation aa_2=new rotateanimation (0,360,
animation.relative_to_self,0.5f,
animation.relative_to_self,0.5f);
Aa_2.setduration (2000);
Aset_2.addanimation (aa_2);
Btn_totate.startanimation (aset_2);
Break


Case r.id.suofang://Zoom Effect
Animationset aset_3=new Animationset (true);
Scaleanimation aa_3=new scaleanimation (1, 0.1f, 1, 0.1f,animation.relative_to_self,1f,animation.relative_to_self,1f );
Aa_3.setduration (2000);
Aset_3.addanimation (Aa_3);
Btn_suofang.startanimation (Aset_3);
Break

Case r.id.yidong://Move Effect
Animationset aset_4=new Animationset (true);
Translateanimation aa_4=new translateanimation (animation.relative_to_parent,0,animation.relative_to_parent, 1,
Animation.relative_to_parent, 0,animation.relative_to_parent, 1);
Aa_4.setduration (2000);
Aset_4.addanimation (Aa_4);
Btn_yidong.startanimation (Aset_4);
Break
}
}

Android four simple animations (fade, rotate, move, zoom effect)

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.