question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Motion] Can't use both Container transition and Shared element

See original GitHub issue

Description: I’m trying to implement transition #1, which is from the new material motion system.

If I use sharedElementEnterTransition = MaterialContainerTransform() then I get a really nice looking container transform, BUT my issue is that my container has an image and I’d like to share that image. There doesn’t seem to be clear guidance on how to do this, so I tried my best with just getting the container (outer viewgroup) and the contained imageView, and it doesn’t seem to work. I can verify that my shared element is working, because if I remove my container transition and just put the transition on the image view via TransitionInflater.from(context).inflateTransition(android.R.transition.move) then I get a nice animated shared element. My issue is that I want both.

Looking at the gif from the material team below, it does seem like they include a package deal of a container transition + a shared element imageview.

https://miro.medium.com/max/1400/1*0vL7z6wwb1X9tvR6_rdQLw.gif image

Expected behavior: As far as I can understand, MaterialContainerTransform() should allow you to chain another shared element.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:26 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
daniel-stoneukcommented, May 1, 2020

Re: the “bad” container transform, I think that’s a relatively common issue we’re seeing when the incoming screen/view doesn’t have a background, but it should be easily fixable.

Have spent ages trying to figure out why my container transform wasn’t scaling and this was the issue! Thanks for this.

1reaction
dsn5ftcommented, Aug 3, 2020

Thanks @ColtonIdle! Let’s file separate issues for anything specific that is happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android multiple shared elements not working with fragments
While these containers are being transformed, their contents are swapped to create the transition. Two shared element doesn't work properly.
Read more >
Page transitions in the browser (Shared Element Transitions)
JakeA: Trying to convince Chrome to implement for years, and now we are, so I'm really excited! … if doing manually, lots of...
Read more >
Navigate between fragments using animations
A shared element transition determines how a view that is shared between two fragments moves between them. For example, an image displayed ...
Read more >
Motion - Material Design
MaterialContainerTransform is a shared element transition . Unlike traditional Android shared elements, it is not designed around a singular piece of shared ...
Read more >
Material Motion: Container Transform - Styling Android
Shared element transitions will animate individual which appear in both start and end states. However, as the name suggests, the container ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found