FragmentTransaction
Fragment操作管理的抽象类类。BackStackRecord
为实现类。
通过FragmentTransaction
对象我们能够对fragment
进行add
、replace
、remove
、hide
、show
、detach
、attach
等。
添加Fragment
- add(Fragment fragment, String tag)
- add(int containerViewId, Fragment fragment)
- add(int containerViewId,Fragment fragment,String tag)
替换Fragment
- replace(int containerViewId,Fragment fragment)
- replace(int containerViewId,Fragment fragment,String tag)
移除Fragment
- remove(Fragment fragment)
显示、隐藏Fragment
- hide(Fragment fragment)
- show(Fragment fragment)
挂载和脱离View
- attacth(Fragment fragment)
- detacth(Fragment fragment)
当前Fragment是否有操作
- isEmpty()
Fragment动画相关
- setCustomAnimations(int enter,int exit)
- setCustomAnimations(int enter,int exit,int popEnter,int popExit)
- addSharedElement(View sharedElement,String name)
- setTransition(int transit)
- setTransitionStyle(int styleRes)
后退栈相关
- addToBackStack(String name)
- isAddToBackStackAllowed()
- disallowAddToBackStack
设置title相关?
- setBreadCrumbTitle
- setBreadCrumbShortTitle
提交
- commit()
- commitAllowingStateLoss()