Reputation: 2519
I want to perform shared element transition when switching from Activity A to Activity B. The problem is that transition animation is not working smoothly when shared imageViews scale types are different. I am noticing a "bounce" in the very beginning of transition (on not animated imageView scaleType change I guess). The same "bounce" I am noticing when coming back from Activity B to Activity A.
Details:
Activity A contains imageView with scaleType: centerCrop. Actvity B contains imageView with scaleType: fitXY.
Both ImageView have android:transitionName="sharedView"
, of course.
My transition set in xml looks like this:
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeBounds/>
<changeImageTransform/>
</transitionSet>
In documentation about this config is written:
In combination with ChangeBounds, ChangeImageTransform allows ImageViews that change size, shape, or ImageView.ScaleType to animate contents smoothly.
So why my transition is not working smoothly? Or how to animate scaleType change during shared element transition if changeBounds
with changeImageTransform
doesn't seem to work?
Worth to mention that if I make scale types equal (e.g. centerCrop and centerCrop) of shared views - then transition works smoothly and everything is ok.
Upvotes: 5
Views: 2167
Reputation: 2487
I've solved this problem in my case. Here is something you need to check:
ImageView
for both source and target activity (Don't use any container).transitionName
for the ImageView (not its container).After I updated this, changeImageTransform
will do its job changing scaleType smoothly between 2 ImageView
s
Upvotes: 0
Reputation: 2446
Had same problem. Solved it by setting same padding
property for both ImageView
's. I don't know why it works so, but hope it can help someone.
Upvotes: -2