android enter popenter区别,android - What is the difference between enter/exit and popEnter/popExit an...

In setCustomAnimations() it takes four resource id for the animation. Not really understand them. If someone having clearer picture of it it would be appreciated if you could explain.

Let's say having fragment A add in the place holder and backstack.

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();

And the replace with fragment 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();

next time if do a popstack()

fm.popBackStackImmediate(FragmentB.FRAGMENT_NAME,

FragmentManager.POP_BACK_STACK_INCLUSIVE);

Which transaction's animation it will be running from?

/**

* Set specific animation resources to run for the fragments that are

* entering and exiting in this transaction. The popEnter

* and popExit 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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值