飞在动画的一个GridView [英] Fly In Animation for a GridView

查看:108
本文介绍了飞在动画的一个GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview,我试图达到的效果苍蝇在其内的图像。这将是非常相似,看到的效果,当你加载图库3D和影像文件夹下降。 我用Google搜索周围的主题,并认为我需要使用一个ViewAnimator并产生通过动画:<一href="http://developer.android.com/reference/android/widget/ViewAnimator.html#setInAnimation(android.view.animation.Animation" rel="nofollow">http://developer.android.com/reference/android/widget/ViewAnimator.html#setInAnimation(android.view.animation.Animation)

I have a gridview, and I am trying to achieve a fly in effect on the images within it. This would be very similar to the effect seen when you load up gallery 3D and your image folders "drop in". I have googled around the subject, and think I need to use a ViewAnimator and generate the animation through that: http://developer.android.com/reference/android/widget/ViewAnimator.html#setInAnimation(android.view.animation.Animation)

不过,我不知道,并就如何实现这一目标承担任何帮助将是非常欢迎!

However, I am not sure and any help on how to achieve this whatsoever would be very welcome!

问候

标记

推荐答案

你要飞每格动画,或整个看法?

Do you want the fly-in animation per grid, or for the entire view?

有关整个视图,使用这样的:

For the entire view, use this:

        Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.flyin);
        findViewById(R.id.YourViewId).setAnimation(anim);
        anim.start();

然后指定一个文件flyin.xml这样的动画:

Then specify your animation in a file flyin.xml like this:

<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="true">
    <scale android:interpolator="@android:anim/decelerate_interpolator"
           android:fromXScale="1.0" android:toXScale="0.0" 
           android:fromYScale="1.0" android:toYScale="0.0"
           android:pivotX="50%" android:pivotY="50%"
           android:fillAfter="false" android:duration="250"/>
</set>

把该文件在您的RES /阿尼姆目录。

Put that file in your res/anim-directory.

这篇关于飞在动画的一个GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆