简体   繁体   中英

How can I animate a Fragment inside a viewpager?

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? (eg 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM