9

我正在尝试在 Android 应用程序中创建过渡动画以在两种布局之间进行更改。我试过搜索动画过渡,但只有淡入淡出过渡、幻灯片过渡、反弹等。我找不到像电源点过渡这样的擦除过渡。

在此处输入图像描述

4

3 回答 3

2

在您的活动中执行以下动画:

这将制作一个从上到下到顶部的动画,您可以轻松地将其操作为水平动画。startActivityForResult(i,ACTIVITY_SLIDE);
overridePendingTransition(R.anim.bottom_in, R.anim.top_out);

top_out.xml,bottom_in.xml 下面...当然需要单独的文件

<?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:anim/linear_interpolator">
        <translate
            android:fromYDelta="100%p"
            android:toYDelta="0"
            android:duration="3000"/>
    </set>




<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator">
    <translate
        android:fromYDelta="0"
        android:toYDelta="-100%p"
        android:duration="3000"/>
</set>
于 2016-03-10T18:52:51.113 回答
1

使用视图的 ClipBound 属性

Rect localRect = view.getVisibileRect();// or you can assign any required rectangle.

Rect rectFrom,rectTo;

Rect rectFrom = new Rect(localRect),rectTo = new Rect(localRect);

now adjust your both starting and ending rectangle according to requirement.

Animator animator = ObjectAnimator.ofObject(shape, "clipBounds", new RectEvaluator(), rectFrom, rectTo);

animator.start();
于 2015-12-23T14:06:46.960 回答
0
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate
            android:duration="700"
            android:fromXDelta="90%"
            android:toXDelta="0" />
    </set>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="700"
        android:fromXDelta="5"
        android:toXDelta="100%" />
</set>
于 2019-03-15T00:28:29.680 回答