Fragment animation : difference between setCustomAnimations and setTransitionStyle

前端 未结 1 1186
悲哀的现实
悲哀的现实 2021-02-07 21:13

I\'d like to animate the transition between two fragments which is performed thanks to FragmentTransaction.replace(). I\'d like to specify my custom animation in a

1条回答
  •  情书的邮戳
    2021-02-07 21:47

    setCustomAnimations(int, int, int, int) allows you to specify your animation resources directly. If you use setTransitionStyle(int), on the other hand, you'll have to specify them by using a FragmentAnimation style and setTransition(int).

    It is worth mentioning that the compatibility library ignores setTransitionStyle(int), so if you are using it you have to use setCustomAnimations(int, int, int, int) for sure.

    For more info on this, check out this excellent post about Fragment states and Fragment animations

    0 讨论(0)
提交回复
热议问题