Android动画同时收缩和淡出一个View

Ada*_* ML 5 android android-animation

我可以淡出.但不是缩水.我希望它看起来像是遥远的远方.

我想要一个类似于www.screamintothevoid.com中使用的动画

Sur*_*rro 16

这应该像你想要的那样工作.

dynamic/in/res/anim

 <set xmlns:android="http://schemas.android.com/apk/res/android">
        <scale xmlns:android="http://schemas.android.com/apk/res/android"
            android:fromXScale="1"
            android:toXScale="0"
            android:fromYScale="1"
            android:toYScale="0"
            android:duration="5000"
            android:pivotX="50%"
            android:pivotY="50%" >
        </scale>

        <alpha
            android:fromAlpha="1"
            android:toAlpha="0"
            android:duration="5000" >
        </alpha>
    </set>
Run Code Online (Sandbox Code Playgroud)

要调用此动画:

TextView textView = (TextView) findViewById(R.id.text_view);
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation);
textView.startAnimation(animation);
Run Code Online (Sandbox Code Playgroud)


Vit*_*nko 5

要缩小视图,请更改其比例值,例如:

TextView textToShrink = (TextView) findViewById(R.id.text_to_shrink);
textToShrink.animate().scaleX(0.3f).scaleY(0.3f).setDuration(600).start();
Run Code Online (Sandbox Code Playgroud)