-
Notifications
You must be signed in to change notification settings - Fork 266
Transition animations
Fragment
default has not transition animation when we are using fragment.But sometimes we need use transition for fragment,the android native fragment provide api to support,but it's not easy to use,so this library can make you easier for fragment transition animation.
Push fragment onto the stackRemove fragment from the stackShow fragmentReplace fragmentHide fragmentRemove fragment- custom
Animation
class
This library only support Xml
animations,if you need more complicated animation,you can extend Animation
class and override Fragment
native method,you can see the demo class ContainerFragment.java,there are two ways to use fragment transition animations.
Add @Animator animation in your fragment needs transition animations
.This animations has four params: enter/exit/popEnter/popExit
correspond respectively with entering animation
/exiting animation
/pop fragment the this stack entering animation
/pop in the stack exiting animation
.
Custom Xml animation
@Animator(enter = R.anim.push_left_in_no_alpha, exit = R.anim.push_right_out_no_alpha,
popEnter = R.anim.push_right_in_no_alpha, popExit = R.anim.push_left_out_no_alpha)
@Puppet
public class StartFragment extend Fragment
Custom animation extends Animation
class
@Puppet
public class StartFragment extend Fragment{
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
if (customAnim) return super.onCreateAnimation(transit, enter, nextAnim);
if (enter) {
return AnimationHelper.createRotate3dEnterAnimation();
} else {
return AnimationHelper.createRotate3dExitAnimation();
}
}
}
- Installation
- Using start
- Fragment usage
- Custom fragment tag
- Lazy loading
- Transition animations
- Intercept onBackPressed
- startFragmentForResult
- Swipe edge to exit
- How to use in library module