This repository contains the sample app created for the STRV engineering blog post on building a collapsing toolbar with Jetpack Compose MotionLayout:
The app demonstrates a collapsing header + scrollable content pattern implemented with:
- Jetpack Compose UI
swipeablestate + nested scroll interopMotionLayoutfromconstraintlayout-compose
As the list scrolls, the header transitions between expanded and collapsed states, animating image size, title position, and text styling.
Main implementation files are in:
app/src/main/java/com/parez/composemotion/MainActivity.kt
App entry point that rendersCollapsableToolbar().app/src/main/java/com/parez/composemotion/CollapsableToolbar.kt
Owns swipe state, nested scroll behavior, and collapse/expand progress.app/src/main/java/com/parez/composemotion/MotionLayoutHeader.kt
Defines start/endConstraintSets and drives MotionLayout interpolation.app/src/main/java/com/parez/composemotion/ScrollableContent.kt
Renders the scrollingLazyColumncontent under the header.
Theme files are in:
app/src/main/java/com/parez/composemotion/ui/theme
This is a standard Android Gradle project.
- Open the project root in Android Studio.
- Sync Gradle.
- Run the
appconfiguration on an emulator or device.
You can also use Gradle from the root:
./gradlew assembleDebug- The project targets older Android Gradle/Compose versions to match the original article implementation.
- Use the linked blog post for a step-by-step explanation of the design and implementation decisions.