I have 2 Activities , the Shared Element transition works fine.ChangeBounds is the only the transition applied.
I want to apply a fade transition while the shared element moves, so the ordering is ORDERING_TOGETHER.
public class TransitionUtils {
public static Transition makeSharedElementEnterTransition(final Context context, final long duration) {
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.setDuration(duration);
Transition changeBounds = new ChangeBounds();
changeBounds.addTarget(context.getString(R.string.transition_name_search_text));
set.addTransition(changeBounds);
Transition fade = new Fade(Fade.OUT);
fade.addTarget(context.getString(R.string.transition_name_search_text));
set.addTransition(fade);
return set;
}
}
The startActivity calls ActivityOptions.makeSceneTransitionAnimation
In the EndActivity , the enter shared element transition is set
public class EndActivity extends Activity{
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.blabla);
getWindow().setSharedElementEnterTransition(TransitionUtils.makeSharedElementEnterTransition(this,2000));
}
}
Notes : I noticed that
- Fade() is often applied to getWindow().setEnterTransition()
- setting a duration to TransitionSet applies to all Transistions contained except Fade.
How to apply a Fade Transition to a sharedElement ? What am I doing wrong ?