フラグメントトランザクションを実行中に、スライドインレットとスライドアウトの正しいアニメーションを挿入しようとしています。アニメーションが適切に動作しています。しかし、私はフラグメントをアニメートしながら白い画面を取得しています。私はgoogleで与えられたすべての解決策に疲れました。しかし、彼らのどれも働いていませんでした。これは私が現在やっていることです。容器内のフラグメントを交換フラグメントのアニメーション中に白い画面が表示される
/** enter_from_left.xml **/
<?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="500"/>
</set>
/** enter_from_right.xml **/
<?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="500" />
</set>
/** exit_to_left.xml **/
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="-100%"
android:duration="500"/>
</set>
/** exit_to_right.xml **/
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:duration="500" />
</set>
は:enter, exit, popEnter, popExit
が参照
public static void replaceAndAddToBackStack(final FragmentActivity activity, final int containerId,
final Fragment fragment, String tag, int enter, int exit, int popEnter, int popExit) {
try {
FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(enter, exit, popEnter, popExit);
transaction.replace(containerId, fragment);
transaction.addToBackStack(tag);
transaction.commitAllowingStateLoss();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
- 私はクロームカスタムタブの同じ遷移を適用する場合>
R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right
は、移行は非常に滑らかでした。白い画面はありませんでした。白い画面がフラグメントトランザクションでのみ表示されるのはなぜですか?私は同じ問題を抱えていたアドバンス