0

私はこれに従って、DevBytes:Window Animationsを実行して、アクティビティを切り替えるときにアニメーションとして変換を実装します。

ユーザーがSUBACTIVITYから戻るボタンを押してMAINACTIVITYに移動したときのアニメーションを除いて、すべてが正常に機能しています。MAIN ACTIVITYがスライドすると、SUBACTIVITYの下に表示され、そのに配置したいと思います。

overridePendingTransition()ユーザーがメインアクティビティに戻ったときにアニメーションを作成するために使用します。

overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right);

slide_in_right.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="-100%p" android:toXDelta="0"
    android:duration="3500" /> 
</set>

slide_out_right.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate xmlns:android="http://schemas.android.com/apk/res/android"
        android:fromXDelta="0" android:toXDelta="50%p"
        android:duration="3500" />
</set>

メインアクティビティが一番上になるように、アニメーション中にウィンドウを並べ替えるにはどうすればよいですか?

4

1 に答える 1

0

同じ質問がありました。overridePendingTransition()サブアクティビティのfinish()次のアニメーションを使用して、アニメーションをスムーズに動作させ、見栄えを良くすることができました。

slide_in_right.xml:

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="-50%p" android:toXDelta="0"
    android:duration="300" />

slide_out_right.xml:

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0" android:toXDelta="100%p"
    android:duration="300" />
于 2013-03-11T10:01:03.260 に答える