Iva*_*ura 5 animation android fragment android-nested-fragment
我有一个活动,里面有一个片段A. 片段A在其内部嵌套了片段B. 我使用以下代码用C切换B:
getChildFragmentManager()
.beginTransaction()
.setCustomAnimations(R.anim.move_left_in, R.anim.move_left_out,R.anim.move_right_in, R.anim.move_right_out)
.replace(R.id.container, fragmentC)
.addToBackStack("nested")
.commit();
Run Code Online (Sandbox Code Playgroud)
之后,我正在做
getChildFragmentManager().popBackStack();
Run Code Online (Sandbox Code Playgroud)
什么让我回到片段B.然后我用代码切换片段A和片段D.
getSupportFragmentManager()
.beginTransaction()
.setCustomAnimations(R.anim.move_up_in, R.anim.move_up_out, R.anim.move_down_in, R.anim.move_down_out)
.replace(R.id.fragment_holder, fragmentD)
.addToBackStack("fragments")
.commit();
Run Code Online (Sandbox Code Playgroud)
当A-> D交易上的动画正在播放时,B播放事务C-> B的动画,并通过弹出backstack获得相同的结果,为什么?
小智 -1
不要使用 getChildFragmentManager(),
使用 support fragmnetManager 意味着使用 getSupportFragmentManager 为什么?
嵌套片段的 Bcz
我希望您的问题能够通过此解决方案得到解决。谢谢你:)
归档时间: |
|
查看次数: |
700 次 |
最近记录: |