¿Cómo puedo animar un fragmento dentro de un visor?

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

preguntado el 04 de marzo de 14 a las 11:03

pregunta similar ... aquí -

1 Respuestas

You can animate it using a PageTransformer

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

respondido 04 mar '14, 11:03

can I use pagetransformer to animate my replacement? - user2426316

Aquí hay dos cosas. PageTransformer will animate the transition between the pages in the ViewPager. setCustomAnimation animará Fragment actas. - ben pearson

el problema con setCustomAnimation is that if I want to use the flip-card effect, then I have to specify a container that contains the fragment which is to replaced with the animation. however, my fragment is just atttached to a viewpager and is not inside a special container - user2426316

Did you ever find a solution to this? I would also like to replace the fragment in the ViewPager with a card flip animation, but like you say - the fragment transaction is all handled by the ViewPager so there's no access to the container? - Matt Wilson

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.