展会信息港展会大全

如何为Gridview以及listview添加动画
来源:互联网   发布日期:2016-01-14 11:32:23   浏览:1746次  

导读:public static void setListViewAnimation() { AnimationSet set = new AnimationSet(false); Animation animation = new AlphaAnimation(0,1); //AlphaAnimation 控制渐变透明的动画效果 animation.setDuration(500); //动画时间毫秒数 set.addAnimation(an...

public static void setListViewAnimation() {

AnimationSet set = new AnimationSet(false);

Animation animation = new AlphaAnimation(0,1);//AlphaAnimation 控制渐变透明的动画效果

animation.setDuration(500);//动画时间毫秒数

set.addAnimation(animation);//加入动画集合

animation = new TranslateAnimation(1, 13, 10, 50);//ScaleAnimation 控制尺寸伸缩的动画效果

animation.setDuration(300);

set.addAnimation(animation);

animation = new RotateAnimation(30,10);//TranslateAnimation控制画面平移的动画效果

animation.setDuration(300);

set.addAnimation(animation);

animation = new ScaleAnimation(5,0,2,0);//RotateAnimation控制画面角度变化的动画效果

animation.setDuration(300);

set.addAnimation(animation);

LayoutAnimationController controller = new LayoutAnimationController(set, 1);

GridView gridView = (GridView) this.findViewById(R.id.gridview);

gridView .setLayoutAnimation(controller);//GridView 设置动画效果

ListView listview= (ListView)this.findViewById(R.id.listview);

}

赞助本站

人工智能实验室

相关热词: android开发 android教程

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港