LayoutAnimationController的使用方法
来源:互联网 发布:sql外连表exists 编辑:程序博客网 时间:2024/04/27 19:40
LayoutAnimationController的使用方法(与ListView结合使用为例)
什么是LayoutAnimationController
1 LayoutAnimationController用于为一个layout里面的控件,或者是一个ViewGroup里面的控件设置动画效果
2 每一个控件都有相同的动画效果
3 这些控件的动画效果在不同的时间显示出来
4 LayoutAnimationController可以在xml文件中设置,也可以在代码中设置
注意到list_anim这个xml文件,其中配置了动画效果,也就是一个动画配置文件(见5中)
<set>
<alpha...>
</set>
2 在布局文件中为ListView添加如下配置(就是在<listview>标签中添加一个属性)
android:layoutAnimation="@anim/list_anim_layout"
在代码中使用LayoutAnimationController
AnimationListener的使用方法
什么是AnimationListener
1 AnimationListener是一个监听器
2 该监听器在动画执行的各个阶段会得到通知,从而调用相应的方法
3 主要包含下面的三个方法
onAnimationEnd(Animation animation)
onAnimationRepeat(Animation animation)
onAnimationStart(Animation animation)
使用方法:
animation.setAnimationListener(new XxxAnimationListener);
其中XxxAnimationListener继承AnimationListene
在其中实现三个onXXX方法
什么是LayoutAnimationController
1 LayoutAnimationController用于为一个layout里面的控件,或者是一个ViewGroup里面的控件设置动画效果
2 每一个控件都有相同的动画效果
3 这些控件的动画效果在不同的时间显示出来
4 LayoutAnimationController可以在xml文件中设置,也可以在代码中设置
在XML中使用LayoutAnimaionController
1 在res/anim文件夹中创建一个文件,名为list_anim_layout.xml
- <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
- android:delay="0.5"
- android:animationOrder="random"
- android:animation="@anim/list_anim" />
<set>
<alpha...>
</set>
2 在布局文件中为ListView添加如下配置(就是在<listview>标签中添加一个属性)
android:layoutAnimation="@anim/list_anim_layout"
在代码中使用LayoutAnimationController
- 1 创建一个Animation对象:
- 可以通过装载xml,也可以直接使用Animation的构造函数创建Animation对象
- 2 创建LayoutAnimationController对象
- LayoutAnimationController lac=new LayoutAnimationController(animation);
- 3 设置控件显示顺序
- lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
- 4 为ListView设置LayoutAnimationController属性:
- listView.setLayoutAnimation(lac);
1 创建一个Animation对象:可以通过装载xml,也可以直接使用Animation的构造函数创建Animation对象2 创建LayoutAnimationController对象LayoutAnimationController lac=new LayoutAnimationController(animation);3 设置控件显示顺序lac.setOrder(LayoutAnimationController.ORDER_NORMAL);4 为ListView设置LayoutAnimationController属性:listView.setLayoutAnimation(lac);
AnimationListener的使用方法
什么是AnimationListener
1 AnimationListener是一个监听器
2 该监听器在动画执行的各个阶段会得到通知,从而调用相应的方法
3 主要包含下面的三个方法
onAnimationEnd(Animation animation)
onAnimationRepeat(Animation animation)
onAnimationStart(Animation animation)
使用方法:
animation.setAnimationListener(new XxxAnimationListener);
其中XxxAnimationListener继承AnimationListene
在其中实现三个onXXX方法
- LayoutAnimationController的使用方法
- Android Animations之LayoutAnimationController的使用方法
- Android Animations之LayoutAnimationController的使用方法
- LayoutAnimationController的初步使用
- LayoutAnimationController
- LayoutAnimationController
- LayoutAnimationController
- LayoutAnimationController
- LayoutAnimationController
- LayoutAnimationController
- 实现ListView的item逐个飞入效果——LayoutAnimationController
- LayoutAnimationController 用法
- 使用LayoutAnimationController
- 用LayoutAnimationController给ViewGroup的item添加动画,以GridView为例
- 程序实现LayoutAnimationController
- Android动画之LayoutAnimationController
- LayoutAnimationController源码深入学习
- LayoutAnimationController实战案例
- 多线程
- THE STREEB-GREEBLING DIARIES-C#版本 MonoSLAM
- tar
- Magento 的目录结构
- Huffman(哈夫曼) 编码压缩算法
- LayoutAnimationController的使用方法
- VC6.0 添加函数注释宏,VS2010同样可以添加
- Debug中标志寄存器的查看
- 黑马程序员 日记七:泛型总结
- 遍历二叉树
- 浮点数有效数字位数
- 第三章 字符设备驱动程序(笔记)
- java Integer.valueOf()方法
- Service: 监听外部存储设备