1.透明动画
.增加视图透明度变化动画
</pre><p></p><pre name="code" class="java"> AlphaAnimation aa = new AlphaAnimation(0, 1);
aa.setDuration(1000);
view.startAnimation(aa);
2.旋转动画
为视度增加旋转变化动画
RotateAnimation ra = new RotateAnimation(0, 360, 100, 100);
ra.setDuration(1000);
view.startAnimation(ra);
以自身的中心点旋转
RotateAnimation ra = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5F, RotateAnimation.RELATIVE_TO_SELF, 0.5F);
ra.setDuration(1000);
view.startAnimation(ra);
3.位移动画
为视度增加移动变化动画
TranslateAnimation ta = new TranslateAnimation(0, 200, 0, 300);
ta.setDuration(1000);
view.startAnimation(ta);
4.缩放动车
为视度增加缩放变化动画
ScaleAnimation sa = new ScaleAnimation(0, 2, 0, 2);
sa.setDuration(1000);
view.startAnimation(sa);
2.以自身的中心点缩放
ScaleAnimation sa = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5F, Animation.RELATIVE_TO_SELF, 0.5F); sa.setDuration(1000); view.startAnimation(sa);
4.动画集合
AnimationSet as = new AnimationSet(true);
as.setDuration(1000);
AlphaAnimation aa = new AlphaAnimation(0, 1);
aa.setDuration(1000);
as.addAnimation(aa);
TranslateAnimation ta = new TranslateAnimation(0, 100, 0, 200);
ta.setDuration(1000);
as.addAnimation(ta);
view.startAnimation(as);
5.布局动画
给ViewGroup添加View时增加一个过度动画
AlphaAnimation aa = new AlphaAnimation(0, 1);
aa.setDuration(2000);
View text = View.inflate(this, R.layout.text, null);
linearLayout.addView(text);
LayoutAnimationController controller = new LayoutAnimationController(aa,0.5f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
linearLayout.setLayoutAnimation(controller);