Compose-View Interop in Practice
summary
Shows how to host existing view libraries like MPAndroidChart inside Compose with AndroidView, and how to embed Compose into XML using ComposeView and the lesser-known ComposeViewAdapter to render parameterized previews (you pick parameterProviderIndex to choose which preview data appears). Demonstrates building a business‑critical custom button and a banner pager, testing interactions with Compose testing + Espresso interoperability, and creating view-backed composables via abstractComposeView. Notes: XML preview needs Android Studio Giraffe Canary 8+, and each ComposeView owns a composition so many ComposeViews can hurt performance.
AI-written summary · about
chapters (10)
- 0:00Introduction and disclaimer
- 0:52What is Compose-View interop
- 2:19Using Android View in Compose
- 4:28Testing hybrid UIs with Espresso
- 6:33Adding Compose to View layouts
- 9:04Compose View Adapter for previews
- 16:03Wrapping Composables with Views
- 22:48Pros and cons of interop
- 25:18Resources and key takeaways
- 27:25Q&A
related talks
33mMigrating to Jetpack Compose - an interop love story
44mComposables in Views: Interoperability and the Clash of Lifecycles
24mState of the art of Compose tooling
38mViews, Compose, Multiplatform - Oh My!
36mCoupling Compose- Interoperability in a Legacy Codebase
18mCompose: Implementing responsive UI for larger screens
06mFrom Views to Compose: Where can I start?
34mBeyond the UI: Compose as a Foundation for Multiplatform Apps
