【发布时间】:2017-10-29 21:58:24
【问题描述】:
我实现片段如下:
- 用于保存父片段的活动。使用 getSupportFragmentManager() 添加父片段。
- 在父片段中,我使用 getChildFragmentManager() 和事务来替换 childFragment。
- 在 childFragment 中我再次调用 childFragment 等等....
- 除共享转换外,一切正常。'
- 如果我使用 getFragmentManager() 而不是 getChildFragmentManager() 则存在共享转换,但没有 getChildFragmentManager() 的概念。
代码示例如下:
/*This code does not show animation*/
getChildFragmentManager()
.beginTransaction()
.addSharedElement(transitionView, ViewCompat.getTransitionName(transitionView))
.replace(R.id.fragment_container, categoryDetailChildFragment)
.addToBackStack(TAG)
.commit();
显示动画的代码是:
getFragmentManager()
.beginTransaction()
.addSharedElement(transitionView, ViewCompat.getTransitionName(transitionView))
.replace(R.id.fragment_container, categoryDetailChildFragment)
.addToBackStack(TAG)
.commit();
为什么getChildFragmentManager()时没有共享过渡?请帮助任何人。
【问题讨论】:
-
您找到解决方案了吗?我有同样的问题..
标签: android android-fragments animation