android - 是否可以为 GridView 提供动画?

标签 android animation gridview

我正在开发一个应用程序,我在其中使用 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/

相关文章:

Android "swipe left to right to delete",列表项上的手势,ICS 样式

android - 检查指纹是否已在三星手机中注册时出现 SecurityException

c# - 如何在路径上设置渐变动画以在 WPF/WCF 应用程序中可视化数据流

javascript - 具有 CSS 动画和过渡效果的 Vue.js Todo 任务

c# - 如何将列表数组与 GridView 或 DataList 绑定(bind)?

android - 在 GridView 持有者模式中显示多次的复选框

c# - gridview 分页不起作用

android - 读取命令时没有输出?

jquery - 动画每个 child jquery

android - 将 ARCore 1.1.0 与 NativeActivity 结合使用并使用其他 IDE 进行构建 (Visual Studio 2015/2017)