listView添加动画
2015-10-28 10:36
169 查看
//给ListView设置动画
mListView.setLayoutAnimation(InLayoutAnim.getAnimationController(300));
public static LayoutAnimationController getAnimationController(int mDuration) {
int duration = 300;
if(mDuration>300)
duration=mDuration;
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(duration);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(duration);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
return controller;
}
mListView.setLayoutAnimation(InLayoutAnim.getAnimationController(300));
public static LayoutAnimationController getAnimationController(int mDuration) {
int duration = 300;
if(mDuration>300)
duration=mDuration;
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(duration);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(duration);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
return controller;
}
相关文章推荐
- Python 列表删除元素
- Erlang HTTP client:ibrowse
- HIVESERVER2 HA配置及使用(java)
- 1043. 输出PATest(20)
- C++11学习笔记2---右值引用与移动构造函数
- Qt ComboBox 小结
- unity3d 虚拟现实在各行业的应用
- android的布局优化
- Hiveserver2配置及优化
- Goldengate monitor v11.1
- Struts的标签--实例
- could not get wglGetExtensionsStringARB
- DFS
- BFS
- Appium:中文输入的问题
- ThinkPad 430C Ubuntu 双显卡安装NVIDIA GT 635M驱动
- canvas入门(画圆)
- 移动端实现标题文字的截断
- Hive HBase集成
- Hadoop 设置任务执行的队列以及优先级和其他 配置