我正在开发一个应用程序,我正在使用GridView显示用户上传的图像。现在我想在某个事件上为整个网格提供某种动画。就像从下到上滑动它或从顶部隐藏它到底。我怎么能实现这个目标?
感谢您提前提供任何帮助
答案 0 :(得分:4)
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(50);
set.addAnimation(animation);
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(100);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(
set, 0.5f);
gridview.setLayoutAnimation(controller);