Reputation: 88
I'm using a shared element transition to go from one activity to another activity. I have a parent layout with a few children and I'm trying to animate them to the detail view using the shared element transitions. I've pushed up a sample repo here on github.
The transition works just fine on the Android emulator, my Pixel, and Samsung phones that haven't been updated to Nougat 7.0. On the Samsung device running 7.0, the image and the text inside the container don't animate properly. In my sample app, the top container is the one that has the issue on Samsung devices and the bottom is how it should look all the time. Here is how it looks on a Samsung device.
Looking at the code, you might ask why not just go with the second solution of only animating the container and in turn get the internals animated with it. I've seen that with some layouts, Android just doesn't animate the internals correctly, sometimes not even at all. So I've resorted to specifying each view that's going to be a shared element transition. Has anyone else ran into this issue?
Upvotes: 4
Views: 440
Reputation: 1
I was running into the same issue with Samsung devices, though I didn't test around Nougat vs. previous Operating Systems.
Try transitioning just the ViewGroup with no transitionName
attribute on the TextViews if possible.
<LinearLayout
...
android:transitionName="ViewGroupTransition">
<!-- No transitions on the TextViews -->
<TextView
android:id="@+id/my_text_view1"
...
/>
<TextView
android:id="@+id/my_text_view2"
...
/>
</LinearLayout>
Adding transitionNames to the TextViews here causes the transition to work incorrectly as you described. The transitionNames should not be required to complete the transition between TextViews if similar TextViews are present in the transition's destination View.
Upvotes: 0