将图标设置为固定位置的动画

时间:2015-08-27 07:01:02

标签: android android-layout listview android-animation

我有一个列表视图,每个列表项都有一个图标。我为每个这样的图标设置了onClickLinstener'这样每当我点击它们时它就会动画。 我想要的是“精灵效应”#39;即,从它的选定图标到达目标位置并消失。我使用了以下动画 -

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

<translate
    android:duration="1000"
    android:fromXDelta="0"
    android:fromYDelta="0"
    android:toXDelta="-100%p"
    android:toYDelta="-300%p" />

<scale
    android:duration="1000"
    android:fillAfter="true"
    android:fromXScale="1.0"
    android:fromYScale="1.0"
    android:pivotX="0%"
    android:pivotY="0%"
    android:toXScale="0"
    android:toYScale="0" />
</set>

并使用 -

调用它
final Animation animationFalling = AnimationUtils
                        .loadAnimation(GIFDemo.this, R.anim.bookmark);
                animationFalling.setFillAfter(true);
                imageView.startAnimation(animationFalling);

(我希望在蓝框中选中图标以达到顶部中心的蓝色图标&#39;虽然我在listview中无法实现)

enter image description here

PS - 虽然我发现它需要NDK才能运行,但我已经尝试this solution了,所以无法运行它

0 个答案:

没有答案
相关问题