Blog Infos

Google Maps has always been one of my favorite apps. The two-layer design makes it so convenient for users to browse the map and find details at the same time. The expanding feature on the front layer makes the information flow so easily and the dragging gesture makes users feel like a magician themselves. 🙂

As an Android dev, I have been always wondering how much engineering work is behind the scenes for the magic to happen. That is probably true for the old Android XML View system. But my recent dive into Jetpack Compose changed my opinion completely, now that the backdrop implementation is given to us almost out of the box with Jetpack Compose.

My Use Case

My company is a flexible workspace provider. Its app currently has the Discovery feature as the home screen, where the map browsing is on the top and the room scrolling is on the bottom. The room browsing can only support the horizontal scrolling. However, our enterprise users(part of our user base) only use one single office location, so they aren’t really interested in the map browsing. However, they all want the vertical scrolling of the room listing for easier discovery.

ONLY Horizontal Scrolling Currently

So the question is how to transition the current UI design into a full-screen vertical scrolling? Our Product and Design team asked us to do a quick prototype to explore the feasibility. Surprisingly, Jetpack Compose actually provides an out-of-box solution, called BackdropScaffold. Here is the result of the proof-of-concept. For demo purposes, I swapped the use case to Movie-Theater browsing but it is the same idea.

 Prototype of 2-layer Design & Vertical Scrolling

Job Offers

Job Offers

    Information Security Engineer

    London, UK
    • Full Time
    apply now


, ,

Migrating to Jetpack Compose – an interop love story

Most of you are familiar with Jetpack Compose and its benefits. If you’re able to start anew and create a Compose-only app, you’re on the right track. But this talk might not be for you…
Watch Video

Migrating to Jetpack Compose - an interop love story

Simona Milanovic
Android DevRel Engineer for Jetpack Compose

Migrating to Jetpack Compose - an interop love story

Simona Milanovic
Android DevRel Engin ...

Migrating to Jetpack Compose - an interop love story

Simona Milanovic
Android DevRel Engineer f ...


Here is the source code repository for anyone interested:

Quick Notes

It is pretty straightforward to customize the BackdropScaffold by following the reference document. But here are a few quick notes that I learned from my POC that could help speed up the learning curve a bit.


This parameter not only defines the scrim color. If you pass Color.Unspecified, the “shielding” effect will be removed from the front layer in the Revealed state, so the front layer can be interacted with custom gestures. Without providing this parameter, the default behavior would “block” the front layer in the Revealedstate and any touch event would always trigger the front layer to pull up into the Concealed state.


All animations in this sample screen are around the BackdropScaffoldState. The snippet below is to drive the state updates to reveal the back layer:

// BackdropScaffoldState to be observed by Compose Runtime
val backdropState = rememberBackdropScaffoldState(BackdropValue.Concealed)
//Launch coroutine to animate revealling backdrop
LaunchedEffect(backdropState) {

Launch Coroutine Effect to Animate Revealing Back Layer


This part is to calculate the alpha values as the state updates are observed:

val backdropState = rememberBackdropScaffoldState(BackdropValue.Concealed)
val offset by backdropState.offset
val halfHeightDp = LocalConfiguration.current.screenHeightDp / 2
val halfHeightPx = with(LocalDensity.current) { halfHeightDp.dp.toPx() }
// Current alpha for vertical list
val verticalListAlpha = ((halfHeightPx - offset) / halfHeightPx).coerceIn(0f..1f)
// Current alpha for horizontal list
val horizontalListAlpha = (offset / halfHeightPx).coerceIn(0f..1f)

Calculate alphas based on backdropState.offset


Maps for Compose
Accompanist for Compose

I used this library to hide the system status bar to maximize Map layout.

Sample Source Code

BackdropScaffold can be applied to many other use cases where the design for browse-to-detail or list-to-sublist pattern makes sense. It is also a great example to show how powerful & productive that Jetpack Compose can be.

To learn about Jetpack Compose itself, I would love to follow up with more posts to share some of my takes along the journey. Stay tuned and happy learning!

This article was originally published on on March 31, 2022



It’s one of the common UX across apps to provide swipe to dismiss so…
In this part of our series on introducing Jetpack Compose into an existing project,…
In the world of Jetpack Compose, where designing reusable and customizable UI components is…

How to animate BottomSheet content using Jetpack Compose

Early this year I started a new pet project for listening to random radio…

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.