Search code examples
androidshared-element-transition

Shared element transition: image view turns white


I have a recycler view containing a bunch of images. When I tap on one of them a detail activity is launched, transitioning the image. My problem is that while the animation is running the image view turns white for a moment which doen't look good. I'm using Glide to load the images if that matters. Thank you in advance!


Solution

  • I have a solution if anyone is interested. The problem was that the image wasn't loaded at the time the animation was performed. My work around is to keep the transition postponed until the image is loaded.

    postponeEnterTransition(); //Postpone the transition
    
    startPostponedEnterTransition(); //Proceede when callback is called