How can I animate a Fragment inside a viewpager?

一曲冷凌霜 提交于 2019-12-22 10:14:57

问题


I have got a viewpager that hosts two Fragments. Now I would like to replace one of the Fragments on a button click. How can I animate this replacement? (e.g. using the flip-card effect)

Since it is difficult two put all my code in here, this is what I basically use http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html


回答1:


You can animate it using a PageTransformer

Or, if you want the animation on replacing a fragment, you can set a custom animation on the FragmentTransaction



来源:https://stackoverflow.com/questions/22171069/how-can-i-animate-a-fragment-inside-a-viewpager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!