0

これは私のスライド アニメーションです。

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_longAnimTime"
    android:fromYDelta="-100%p"
    android:toYDelta="-30%p" />

スライドは問題ありません。しかし、ビューは常に画面の中央に落ち着きます。上記のコードに問題はありますか?

ありがとう、ラフル。

4

1 に答える 1

1

属性fillAfterを「true」に設定する必要があります。

コード:

animation.setFillEnabled(true);
animation.setFillAfter(true);

XML:

<set
    android:fillEnabled="true"
    android:fillAfter="true"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <translate
    android:duration="@android:integer/config_longAnimTime"
    android:fromYDelta="-100%p"
    android:toYDelta="-30%p" />

</set>

お役に立てば幸いです。

于 2012-12-24T15:52:51.323 に答える