Booyaches
Booyaches

Reputation: 1719

Animate View in Fragment with FragmentTransaction.setCustomAnimations()

I usually use FragmentTransaction.setCustomAnimations(int enter, int exit) to specify fragment's entering and returning transition animations. For as much as I understand, the animation passed to the method can only be applied to the whole fragment view. I can tell the whole fragment to slide/fade in or out etc.

Haveing transaction from fragment A to B, is it possible to specify animation, so that upon replace, a specific view within fragment B gets animated? Let's say I want this view to travel from point X to Y and I want to specify this behaviour in resources passed to FragmentTransaction.setCustomAnimations(int enter, int exit). Is there a way to do that?

Upvotes: 1

Views: 824

Answers (1)

azizbekian
azizbekian

Reputation: 62189

FragmentTransaction.setCustomAnimations() applies animation to the Window of your Activity. Thus, views that are inside your Fragment cannot be animated. You have to switch to Transition animations.

Upvotes: 1

Related Questions