Shared element transition implementation in Android app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Shared element transition implementation in Android app
Medium
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Shared Element Transition in Android Applications

Shared Element Transition in Android is a mechanism where a View from one screen visually "moves" to another. A news list, a card with an image—user taps, and the image smoothly expands to a full-screen detail view. It doesn't disappear and reappear; it moves with animation of shape, size, and position.

Available via Fragment Transitions API (traditional) and Compose SharedTransitionLayout (modern).

Fragment Transitions: Activity and Fragment

Between Activity:

// From ListActivity on item click:
val intent = Intent(this, DetailActivity::class.java)
intent.putExtra("productId", product.id)

val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
    this,
    imageView,                    // view on current screen
    "product_image_transition"    // transitionName—matches on both screens
)
startActivity(intent, options.toBundle())
// In DetailActivity:
ViewCompat.setTransitionName(detailImageView, "product_image_transition")
// postponeEnterTransition() + startPostponedEnterTransition() if image loads async

If the image loads via Glide or Coil, use postponeEnterTransition() before loading starts and startPostponedEnterTransition() in the load callback. Otherwise, animation starts before the image appears, and transition works with a placeholder.

// In DetailActivity.onCreate():
postponeEnterTransition()

Glide.with(this)
    .load(imageUrl)
    .listener(object : RequestListener<Drawable> {
        override fun onResourceReady(...): Boolean {
            startPostponedEnterTransition()
            return false
        }
        override fun onLoadFailed(...): Boolean {
            startPostponedEnterTransition() // also on error
            return false
        }
    })
    .into(detailImageView)

Between Fragment via Navigation Component:

// In ListFragment:
val extras = FragmentNavigatorExtras(
    imageView to "product_image_transition"
)
findNavController().navigate(
    R.id.action_list_to_detail,
    bundleOf("productId" to product.id),
    null,
    extras
)

// In DetailFragment.onCreate():
sharedElementEnterTransition = TransitionInflater.from(requireContext())
    .inflateTransition(android.R.transition.move)
postponeEnterTransition()

android.R.transition.move is the standard transition, includes bounds change, translation, and clip bounds. For custom behavior, use TransitionSet with ChangeBounds, ChangeImageTransform, ChangeClipBounds.

Return: Shared Element automatically animates return transition on popBackStack() or back button. sharedElementReturnTransition can be configured separately—e.g., different easing for the reverse.

Jetpack Compose: SharedTransitionLayout

Compose 1.7+ (stable) introduced SharedTransitionLayout and SharedTransitionScope:

SharedTransitionLayout {
    NavHost(navController, startDestination = "list") {
        composable("list") {
            AnimatedVisibility(visible = true) {
                ProductList(
                    onProductClick = { product ->
                        navController.navigate("detail/${product.id}")
                    },
                    sharedTransitionScope = this@SharedTransitionLayout,
                    animatedVisibilityScope = this@AnimatedVisibility
                )
            }
        }
        composable("detail/{id}") { backStackEntry ->
            AnimatedVisibility(visible = true) {
                ProductDetail(
                    productId = backStackEntry.arguments?.getString("id"),
                    sharedTransitionScope = this@SharedTransitionLayout,
                    animatedVisibilityScope = this@AnimatedVisibility
                )
            }
        }
    }
}

// In ProductList:
@Composable
fun ProductCard(
    product: Product,
    sharedTransitionScope: SharedTransitionScope,
    animatedVisibilityScope: AnimatedVisibilityScope,
) {
    with(sharedTransitionScope) {
        AsyncImage(
            model = product.imageUrl,
            modifier = Modifier.sharedElement(
                rememberSharedContentState(key = "product-image-${product.id}"),
                animatedVisibilityScope
            )
        )
    }
}

The key must match on both screens. sharedElement handles geometric transition, sharedBounds when the container also smoothly changes size.

Common Mistakes

transitionName set on only one screen—transition silently fails. Always check both directions.

RecyclerView with many elements: call setTransitionName in onBindViewHolder with unique name per item (e.g., "product_image_${product.id}"). Using the same name means Android doesn't know which view to animate.

Shared Element over system navigation (edge-to-edge): if view is near the edge and content behind navigation bar, WindowInsetsCompat may offset layout, and transition final position differs from actual. Fixed via proper inset application through ViewCompat.setOnApplyWindowInsetsListener.

Timeline

Shared Element Transition between two screens (image + title) takes 1 day. With async image loading support, custom transition set, and reverse animation, allow 1–2 days. Cost is calculated individually.