Shared Element Transition in Android: Activity, Fragment, Compose

Abrupt transitions between screens frustrate users and reduce conversion. We develop and implement shared element transitions in Android turnkey — from Activity and Fragment to Compose. Navigation becomes smooth, and user retention grows.

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.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a mobile application for FEEDME
    Development of a mobile application for FEEDME
    971
  • Development of a mobile application for XOOMER
    Development of a mobile application for XOOMER
    869
  • Development of a mobile application for RHL
    Development of a mobile application for RHL
    1289
  • Development of a mobile application for ZIPPY
    Development of a mobile application for ZIPPY
    1143
  • Development of a mobile application for Affhome
    Development of a mobile application for Affhome
    1076
  • Development of a mobile application for the FLAVORS company
    Development of a mobile application for the FLAVORS company
    677

Shared Element Transition in Android: What Breaks Without It

The user taps on a product card — and instead of the image smoothly flying to its place in the detail screen, the app momentarily shows a white rectangle, then abruptly redraws the entire layout.

The list and the detail live as two disconnected worlds: the user loses context, has to search again with their eyes for the same element, and the feeling of a "heavy" app is built from dozens of such micro-breaks.

Shared Element Transition in Android solves exactly this: the same visual element continuously transitions from one screen to another, and navigation between screens reads as a single motion rather than as a swapped image.

Without shared transitions, it's not just aesthetics that suffer. Every abrupt screen swap is a rebuild of the view tree and a full redraw, which causes noticeable frame drops on mid-range devices when navigating back.

The user doesn't understand where they came from or where they'll return to: the "back" button feels like a rollback into the unknown rather than a return to the same spot in the list.

The smoothness of the interface directly affects perceived speed — a screen that "flows" subjectively feels faster, even if the response time is the same.

A separate pain point is the desynchronization between approaches.

In classic Activity and Fragment, transitions are built on shared elements and transition pairs; in Fragment, you additionally need to coordinate the lifecycle and postponed transitions; and in Compose the model is different — shared elements are bound to keys within navigation.

When some screens use one mechanism and some use another, visual coherence breaks exactly at the seams: the animation is present on one transition and disappears on the adjacent one, and the user sees sloppiness rather than intentional design.

Let's break down how this is solved: how to build a unified transition language on top of Activity, Fragment, and Compose so that the element doesn't "jump" between screens and navigation remains predictable.

What Shared Element Transitions Deliver

Shared element transitions are when an element (a product image, an avatar, a card) doesn't disappear on one screen and appear on another, but physically flies between them.

The user sees a continuous connection between the list and the detail, so they perceive navigation as a single motion rather than a change of frames.

On Android this is implemented through shared element names and a single transition container — the mechanics differ across Fragment, Activity, and Compose, but the result for the user is the same.

What Changes in Interface Metrics

The main effect is a drop in the share of interrupted transitions. When a user taps a card and instantly sees what opened, they press "back" mid-way less often.

Based on our practice, on catalogs and feeds the share of returns to the previous screen in the first seconds drops by 20-40%, and viewing depth grows: a person goes 1-2 screens further because they don't lose context.

The perceived speed also changes without speeding up the loading itself. Even if the detail data is still loading, the shared element transition already shows where we landed — the interface feels responsive. Smooth animation here is not decoration, but a way to hide real network latency.

Where the Effect Is Most Noticeable

  • Catalogs and feeds: the "tile → product card" transition keeps attention on the object.
  • Profiles and social features: the avatar and cover fly into the header, reducing the feeling of a break.
  • Media and galleries: the image expands to full screen without a white flash between screens.

For this to work reliably, shared element names are set explicitly, and the transition is constrained by duration and curve — otherwise on weak devices the animation starts to stutter and the effect turns against the user.

Implementation Approaches: Activity, Fragment, Compose

The overall transition is built differently depending on where the screen lives.

In classic Activity, the "source element → target element" pair is linked via sharedElementEnterTransition and sharedElementReturnTransition, and the match is set by the string key transitionName.

In Fragment, the same mechanism works through FragmentTransaction.addSharedElement(), but a condition is added: the transaction must be postponed until the layout is ready, otherwise the target view does not yet exist and the transition silently fails.

In Compose, there was no separate API for shared transitions for a long time, and before the built-in mechanism appeared, teams assembled it manually on AnimatedContent and coordinated offsets.

Option When it fits Limitations
Activity Transition between independent screens, different entry points transitionName keys are unique within a window; return requires explicit configuration of sharedElementReturnTransition
Fragment Screens within a single Activity, shared container and navigation Requires a postponed transaction and layout readiness; when the view is recreated, the transition is lost
Compose A single UI layer, navigation within one composition tree Requires coordinating keys between screens; some animations have to be assembled manually

What determines the choice

The deciding factor is not how "trendy" the approach is, but how many times the screen is recreated over the app's lifetime and how rigidly the source and target elements are linked.

If the screens live in different Activities and are invoked from external entry points, the classic mechanism remains the most predictable: it does not depend on the composition tree and survives window recreation.

If navigation is already built on fragments, it is cheaper to stay with it — but you will have to discipline yourself to postpone transactions and keep an eye on the view lifecycle.

Where it most often breaks

The main failures are key desynchronization and state loss on screen rotation. A key set in one place that does not match in another does not produce an error, but simply the absence of animation — which is the most expensive thing to debug.

In Compose, there is an added risk that the element is recreated on recomposition and the animation is cut off midway.

That is why we pin the keys in one place, verify behavior on recreation, and separately run through the return — it is precisely the reverse transition that most often remains unfinished.

How we implement Shared Element Transition on Android

We start implementation not with code, but with a navigation audit: we inventory screens, mark shared visual elements (covers, avatars, product cards), and record between which screens a transition delivers a real benefit and where it is excessive.

At this same step we check how navigation is currently structured — a single Activity or several, where the fragments live, whether there is a Compose screen in the chain — because the choice of transition mechanics depends on this.

  1. Navigation audit and scenario selection. We build a transition map, mark "source → destination" pairs with a shared element, and prioritize by frequency of use. For each scenario we record the expected behavior: what exactly flies over, what dissolves, what stays in place.
  2. Transition design. For each pair we choose the mechanics: a classic transition between Activities, a transition between fragments, or a shared element in Compose. We define shared element names so that the pairing is found automatically, and we set the duration and motion curve.
  3. Transition setup. We configure the linking of shared elements, postponed transitions for screens that are still loading content, and the behavior on back navigation. We separately work through the case when the target screen is opened from a list or from a notification — there the transition source is different.
  4. Compatibility and fallback. We check behavior on different system versions and with animations disabled in accessibility settings: the transition must not break, but correctly collapse into a regular one.
  5. Animation testing. We run the scenarios on low-end and flagship devices, measure dropped frames and response time, and check whether the list jitters on back navigation. We separately test screen rotation and app minimization at the moment of transition.
  6. Documentation handover. We deliver the transition map, the list of shared element names, the adopted durations and curves, as well as instructions on how to add a new transition using our template.

Each stage ends with an artifact that can be verified: a navigation map, a transition specification, a set of automated animation tests. Describe your navigation — we will come back with an estimate and a work plan.

Artifacts and configurations you receive

We hand over not a "folder with source code" but a complete set that lets screen transitions be reproduced, reviewed, and fixed without the author. Below is what exactly remains with you after the Shared Element Transition phase of work.

  • Transition maps — a "source screen → destination screen" map indicating shared elements, direction of motion, and return behavior. We separately record the cases where a transition cannot be built: orientation change, process restoration, deep links.
  • Animation configuration — duration, interpolation, and delay parameters are moved into a separate layer rather than scattered across screen code. When transition behavior changes, one file is edited instead of ten places.
  • Shared element markup — naming conventions and attributes by which an element is linked between screens. A single vocabulary eliminates the situation where two developers name the same block differently.
  • Rollback procedure — what to do if a transition breaks navigation on a specific OS version: how to disable the animation in a targeted way without shipping a whole new release.
  • Team instructions — a short document on "how to add a new transition in 15 minutes": which steps are mandatory, where typical mistakes occur, what to check before handover.
  • Acceptance checklist — a set of scenarios by which the transition is verified manually and by automated tests: cold start, going back, gesture interruption, low-end device.
  • List of known limitations — where the animation is deliberately simplified and why. This removes the "why isn't this like in the mockup" questions in future iterations.

Everything listed above is working files in your repository and wiki, not a presentation. A new team or contractor picks up the transitions from these materials without reaching out to us.

Case study: speeding up navigation in an e-commerce app

The client is a chain of online stores with an app boasting several hundred thousand active users.

Complaints in reviews repeated over and over: "it lags when opening a product," "I go back to the catalog and lose my place." Moving from the list to the product page took about 900 ms and was accompanied by a white screen: the new screen rendered from scratch while the image and price loaded. The user lost context, and with it the motivation to keep browsing.

What we changed

We moved navigation to a shared transition between screens: the product page now "grows" out of its place in the list, and the "back" button returns to exactly the same position in the catalog with scroll preserved.

At the same time, we reworked data loading — price and availability are fetched before the animation starts, so the transition doesn't wait for a network response. Separately, we fixed returning from deep screens: the cart and filters no longer reset the list state.

What the results were

Metric Before After
Time to transition to the product page ~900 ms ~180 ms
Share of successful returns to the catalog 71% 94%
Browsing depth per session 4.2 product pages 6.8 product pages
Share of reviews complaining about speed 12% 2%

We should also note retention: the share of users returning to the app the next day grew by 9 percentage points — navigation stopped being the place where people abandoned the flow.

The work took three weeks: one week to analyze the current transitions and bottlenecks, and a week and a half for implementation and testing on real devices, including budget models.

Google Play reviews after the update show a shift in tone: instead of "it lags" — "it's become a pleasure to scroll." This is a case where a technical navigation fix is directly reflected in product metrics.

How does Shared Element Transition in Compose differ from the View system?

The difference grows out of the paradigm. The View system is imperative: you manually find the target Views, assign them a transitionName, assemble "source → destination" pairs, and pass them to the transition builder.

Compose is declarative: you describe the screen state, and the correspondence of elements between screens is derived from a shared key that you assign via Modifier.sharedElement. No manual pairs — only the identity of the element in two states of the tree.

In the View system, the transition lives at the Activity or Fragment level. You call startActivity with transition options, and the system itself animates the matched Views between windows.

In Fragment scenarios, manual work with shared elements and postponed transitions is added: you need to wait until the target layout is ready, otherwise the animation starts over an empty space.

In Compose, the transition is part of the composition: AnimatedContent, SharedTransitionLayout, and a shared key link elements within a single tree, and the boundaries of an Activity or navigation graph cease to be a hard constraint.

The practical differences show up in three places.

First — predictability: in Compose you describe how an element looks at the start and at the end, and the environment takes care of the interpolation; in View you control every step and are responsible for the consistency of states.

Second — reuse: a shared key works both within a single screen and between navigation destinations, whereas imperative pairs have to be reassembled for each scenario.

Third — debugging: a declarative transition is reproduced from state, an imperative one depends on the order of calls and the lifecycle.

The limitations are different too. In the View system, it is harder to synchronize a transition with asynchronous data loading: an element may "jump" if the content arrives after the animation.

In Compose, the requirements for key stability are higher — a randomly changing key breaks the link and the transition does not fire.

The choice is dictated not by fashion, but by where your interface lives: a mixed project with Activity and Fragment is more logical to develop on View mechanics, while Compose screens get transitions for free from the declarative description.

Common technical concerns

Transitions between screens are the part of the interface where compatibility and support questions come up most often. Below is a breakdown of the typical concerns that teams have before implementation.

How compatible is this with older versions of Android?

The basic mechanism of transitions between Activity and Fragment works at the platform level and does not require a separate library.

On older versions of the system, the animation will simply render without the smooth "morphing" of the shared element — the interface will remain functional, and the degradation will affect only the visual layer.

For Compose, the behavior is defined explicitly through modifiers, so there we control the fallback to a regular screen appearance on any version. The result: a single codebase with no branching for each version of the system.

Will performance suffer on low-end devices?

The main load is synchronizing the position and size of the shared element between two screens. If a screen has heavy lists or complex rendering, the transition may stutter.

We keep the animation within limits where it does not block the main thread, and we disable the morphing on devices with limited resources. Then the response time remains predictable, and the effect is enabled where it is actually noticeable.

How difficult is it to maintain going forward?

Complexity appears when transitions are scattered across screens and tied to specific layouts. We move them into a separate layer with unified rules: where an element is shared, what it is called, what happens on return.

Then a new screen is connected via a template rather than rewritten from scratch. This reduces the cost of edits and eliminates a class of errors where, after refactoring one screen, the transition on another "breaks."

Can it be implemented gradually, without stopping releases?

Yes. Transitions are added one screen at a time and do not affect the navigation logic. We start with a key scenario, test on real devices, then expand. If something goes wrong, the effect is disabled in a targeted way, and the app continues to work as before.

Describe your scenario — we will get back to you with an estimate and a phased plan.

Let's discuss your transition animation task

A discussion of a transition animation task begins with analyzing exactly where the transitions "break": between Activities, within Fragment navigation, or in the Compose graph.

We look at the current screen structure, the navigation approach, and which elements should "fly" between states. This determines exactly where to place the shared element and how to synchronize its lifecycle with the target screen.

Next, we build a work plan — from diagnostics to testing on real devices. Below is a list of what our team can do for your project.

  • Conduct an audit of current transitions and find places where animation conflicts with navigation or redraws.
  • Determine which screens are switched to shared elements and where standard transitions are sufficient.
  • Design a naming scheme for shared elements and their transfer between screens without losing state.
  • Implement transition animations for Activity, Fragment, and Compose in a unified style.
  • Set up correct handling of images and lists so elements don't "jump" during loading.
  • Test behavior on low-end devices and with slow networks, eliminate stutters and freezes.
  • Prepare documentation for adding new transitions so the team can replicate the approach without us.

Based on the discussion, you will receive an estimate of timelines and scope of work, as well as a plan for the order in which to implement transitions so as not to break current scenarios. Describe your task — we'll get back to you with an estimate and a plan.