首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 平面设计 > 图形图像 >

Android开发-图形图像与卡通(五)-详解LayoutAnimationController

2013-01-28 
Android开发--图形图像与动画(五)--详解LayoutAnimationController首先需要先介绍下LayoutAnimationContro

Android开发--图形图像与动画(五)--详解LayoutAnimationController

  首先需要先介绍下LayoutAnimationController:

 * 1.LayoutAnimationController用于为一个layout里面的控件,或者是一个ViewGroup
 * 里面的控件设置动画效果(即整个布局)
 * 2.每一个控件都有相同的动画效果
 * 3.这些控件的动画效果在不同的实现显示出来
 * 4.LayoutAnimationController可以在xml文件当中设置,也可以在代码中进行设置

本文就针对两种实现LayoutAnimationController的方法分别进行介绍:

一,在XML文件中实现

步骤如下图所示:

Android开发-图形图像与卡通(五)-详解LayoutAnimationController
 
 下面以一个实例来说明实现的方法:

实现的例子是点击“测试”按钮,有动画形式的view展现出来,截图如下:

Android开发-图形图像与卡通(五)-详解LayoutAnimationController

具体的实现过程如下:

需要两个动画xml文件:

1.list_item_layout


在本例中用到的代码如下:

Animation animation=AnimationUtils.loadAnimation(LayoutAnimation_Activity.this, R.anim.list_item_alpha);LayoutAnimationController laController=new LayoutAnimationController(animation);laController.setOrder(LayoutAnimationController.ORDER_NORMAL);listView.setLayoutAnimation(laController);


热点排行