6

あるアクティビティから次のアクティビティへのアニメーショントランジションをAndroidで作成したいと思います。しかし、アニメーション中に、黒い背景の短い停電があり、次に表示したい次のアクティビティのアニメーションが表示されます。

最初のアクティビティをそのまま保持して、2番目のアクティビティがアニメーション化して最初のアクティビティとオーバーラップするようにします。どうすればこの動作を実現できますか?

これが私の現在の2つのアニメーションxmlファイルですが、私が達成したいことを実行していません:

hold.xml

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

    <translate
        android:duration="2000"
        android:zAdjustment="bottom" />

</set>

enter.xml

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

    <translate
        android:duration="2000"
        android:fromXDelta="90%"
        android:fromYDelta="0%"
        android:toXDelta="0%"
        android:toYDelta="0%"
        android:zAdjustment="top" />

</set>

私のJavaコード:

starter.overridePendingTransition(R.anim.enter,
                R.anim.hold);

よろしくお願いします、パット

4

2 に答える 2

13

アクティビティアニメーションを入力してください

startActivity(new Intent(this, AnimaitonActivity.class));
overridePendingTransition(R.anim.pull_up_from_bottom, R.anim.hold);

アクティビティアニメーションを終了します

finish();
overridePendingTransition(R.anim.hold, R.anim.push_out_to_bottom);

pull_up_from_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromYDelta="100%"
    android:toYDelta="0%" />

push_out_to_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromYDelta="0%"
    android:toYDelta="100%" />

hold.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >
    <translate
        android:duration="2000"
        android:zAdjustment="bottom" />
</set>
于 2014-01-28T07:16:02.360 に答える
-1

アクティビティAからアクティビティBに移行するデフォルトのアニメーションは、デバイスによって異なります。デバイスがそのように実装しているために画面が少しの間黒くなる場合...ただし、アプリのテーマがカスタムアニメーションを適用してアクティビティ間を移行するために使用するアニメーションをオーバーライドできます。

于 2012-06-02T11:41:38.517 に答える