setCustomAnimations()では、アニメーションに4つのリソースIDが必要です。本当にそれらを理解していない。誰かがそれをより鮮明に描写していれば、説明することができれば分かります。Enter/ExitとpopEnter/popExitの違いは何ですか?ポップスタックで実行するトランザクションのアニメーション
フラグメントAをプレースホルダとバックスタックに追加したとします。
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.holder, fragA, FragmentA.FRAGMENT_NAME);
ft.addToBackStack(FragmentA.FRAGMENT_NAME);
ft.setCustomAnimations(R.anim.slide_in_from_bottom, R.anim.slide_in_from_top, R.anim.slide_in_from_left, R.anim.slide_in_from_right);
ft.show(frag);
ft.commit();
とフラグメントBと交換してください:
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.holder, fragB, FragmentB.FRAGMENT_NAME);
ft.addToBackStack(FragmentB.FRAGMENT_NAME);
ft.setCustomAnimations(R.anim.slide_in_from_bottom, R.anim.slide_in_from_top, R.anim.slide_in_from_left, R.anim.slide_in_from_right);
ft.show(frag);
ft.commit();
次回popstack()が実行されているからであろうトランザクションのアニメーション
fm.popBackStackImmediate(FragmentB.FRAGMENT_NAME,
FragmentManager.POP_BACK_STACK_INCLUSIVE);
をすれば?
/**
* Set specific animation resources to run for the fragments that are
* entering and exiting in this transaction. The <code>popEnter</code>
* and <code>popExit</code> animations will be played for enter/exit
* operations specifically when popping the back stack.
*/
public abstract FragmentTransaction setCustomAnimations(@AnimRes int enter,
@AnimRes int exit, @AnimRes int popEnter, @AnimRes int popExit);