Please, I need help with the transitions. I activity_main2.xml
have two views, one is one ImageView
and the other is one FloatingActionButton
. What I want is that when I enter activity 2 from my activity 1, I do it with animation but separated, that is, the ImageView
one that enters with start
and the FloatingActionButton
one that enters with Top like this separately I have this trasition
on me res
and even so it moves me all together.
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:transitionOrdering="together">
<slide android:slideEdge="start">
<targets>
<target android:targetId="@id/imagenPortada" />
</targets>
</slide>
<slide android:slideEdge="top">
<targets>
<target android:targetId="@id/fab" />
</targets>
</slide>
</transitionSet>
And this is my style where I define and activate my transitions
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#E21E63</item>
<item name="colorPrimaryDark">#C2145B</item>
<item name="colorAccent">#FFFFFF</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowEnterTransition">@transition/transition</item>
<item name="android:windowExitTransition">@transition/etransition</item>
</style>
This is more or less what I want to achieve but in this case only with the floatingButton and the cover
The problem is that you are using a TransitionManager , to be able to move the elements separately, what you are using is to animate two layouts!
In this case when "activity 2" starts you could simply use ObjectAnimator to control the translation of the elements, for example if you want an animation of your image from top to bottom you can do it with:
more information Animating Views (English)