Posted by Jolanda Verhoef, Android Developer Relations Engineer
Today, we’re releasing version 1.2 of Jetpack Compose, Android's modern, native UI toolkit, continuing to build out our roadmap. This release contains new features like downloadable fonts, lazy grids, and improvements for tablets and Chrome OS with better focus, mouse, and input handling.
Compose is our recommended way to build new Android apps for phone, tablets and foldables. Today we also released Compose for Wear OS 1.0 - making Compose the best way to build a Wear OS app as well.
We continue to see developers like the Twitter engineering team ship faster using Compose:
“Compose increased our productivity dramatically. It’s much easier and faster to write a Composable function than to create a custom view, and it’s also made it much easier to fulfill our designers’ requirements.”
Compose 1.2 includes a number of updates for Compose on Phones, Tablets and Foldables - it contains new stable APIs graduated from being experimental, and supports newer versions of Kotlin. We've already updated our samples, codelabs, Accompanist library and MDC-Android Compose Theme Adapter to work with Compose 1.2.
Note: Updating the Compose Compiler library to 1.2 requires using Kotlin 1.7.0. From this point forward the Compiler releases will be decoupled from the releases of other Compose libraries. Read more about the rationale for this in our blog post on independent versioning of Jetpack Compose libraries.
New stable features and APIs
Several features and APIs were added as stable. Highlights include:
- The APIs
LazyVerticalGridlet you place lists of items in a grid. These APIs already existed in Compose 1.1 but were marked as
WindowInsetsclass provides modifiers such as
windowInsetsTopHeightto deal with the insets of the device. This class is heavily based on the Accompanist insets library, and replaces it as the preferred mechanism for Insets.
Modifier.nestedScrollprovides nested scroll interoperability with views. Here’s a sample demonstrating this new functionality. Learn more in the gestures documentation.
- Easing curves were added that help write beautiful animations efficiently. Read more about how to use them in our animation guidance.
- Mouse support was improved, by adding Modifier.pointerHoverIcon, PointerEventType.Scroll, and
New Experimental APIs
We’re continuing to bring new features to Compose. Here are a few highlights:
- Create your own custom efficient scrollable layouts with
LazyLayout. Add custom overscroll effects to your scrollable container using
- Downloadable fonts using
GoogleFont. Read the documentation to get started.
- Many text features were added, such as allowing customization of
includeFontPaddingand line heights (see Text documentation and blog post),
BrushAPIs (see blog post), and the addition of
- Improved test APIs. For example, the
performKeyInputaction mimics keyboard input in your tests. The new testTagsAsResourceId semantics property allows integration with UI Automator.
We fixed a lot of issues raised by the community, most notably:
- Let animations follow the system defined “Animator duration scale”.
- Allow disabling of scrolling of lazy layouts by adding
- Make the back button behavior in
TextFieldidentical to the behavior in
We’re grateful for all of the bug reports and feature requests submitted to our issue tracker - they help us to improve Compose and build the APIs you need. Do continue providing your feedback and help us make Compose better!
Wondering what’s next? Check out our updated roadmap to see the features we’re currently thinking about and working on, such as animations for lazy item additions and removals, flow layouts, text editing improvements and more!
Jetpack Compose continues to evolve with the features you’ve been asking for. We’ve been thrilled to see tens of thousands of apps using Jetpack Compose in production already, and many of you shared how it’s improved your app development. We can’t wait to see what you’ll build next!