0

デフォルトのアクティビティ遷移アニメーションを置き換えようとしましたが、成功しませんでした。

私は独自の入口と出口のアニメーションを定義しており、新しいアクティビティが開始されるコールバックには次のコードがあります。

public void goFetchCallback(View view)
{
    Intent intent = new Intent(this, RecipiesActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(intent);
    overridePendingTransition(R.anim.entryanim,R.anim.exitanim);
}

残念ながら、これは機能しません。その理由はわかりません。

ICS を搭載した Motorola Xoom でこれを実行しています。

また、以下のカスタム スタイルを使用して、デフォルトのアニメーションを無効にしようとしました。

    <style name="AppTheme" parent="@android:style/Theme.Holo">
    <item name="android:windowAnimationStyle">@null</item>      
</style>

これをManifest.xmlのアプリケーションに割り当てますが、やはり成功しません。

誰か助けてくれませんか?

ありがとう

4

1 に答える 1

0

問題は、アニメーションを無効にしていたコードにはありませんでした。問題はアニメーション自体にありました。実際、これはXoomのデフォルトのアニメーションとほぼ同じであり、混乱を招きました。

完全を期すために、アニメーションを無効にするためのコードと、開始アニメーションと終了アニメーションを投稿しています。それらは、いくつかのフェードとともに右から左へのアニメーションを実現します。

活動を呼び出すとき:

Intent intent = new Intent(this, RecipiesActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
overridePendingTransition(R.anim.entryanim,R.anim.exitanim);

entryanim:

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

    <translate 
        android:fromXDelta="100%"
        android:toXDelta="0%"
        android:duration="1000"
        android:interpolator="@android:anim/accelerate_decelerate_interpolator"/>
    <alpha
        android:fromAlpha="0"
        android:toAlpha="1"
        android:interpolator="@android:anim/accelerate_interpolator" 
        android:duration="1000"/>
</set>

とexitanim:

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

    <alpha 
        android:fromAlpha="1"
        android:toAlpha="0"
        android:duration="1000"
        android:interpolator="@android:anim/accelerate_interpolator"/>
</set>
于 2012-09-15T21:46:26.607 に答える