首页 > 代码库 > Android ListView Animation 布局动画

Android ListView Animation 布局动画

    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);      listview.setLayoutAnimation(controller);   //ListView 设置动画效果