我正在开发一个应用程序,我在其中使用 GridView 来显示用户上传的图像。现在我想在某些事件中为整个网格提供某种动画。比如将它从底部滑动到顶部或从顶部隐藏它到底部。我怎样才能做到这一点?
提前感谢任何可能的帮助
最佳答案
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);
关于android - 是否可以为 GridView 提供动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20185764/