头图

Author / Android Developer Relations Engineer Florina Muntenescu

As always, we have built product roadmap and have now released version 1.1 of Jetpack Compose , the modern native interface toolkit for Android. This release adds features like optimized focus handling, touch target values, ImageVector caching, and support for Android 12 stretch scrolling. Compose 1.1 also transitions many previously experimental APIs to stable and supports new versions of Kotlin. We have updated the example , and Accompanist development library to work with Compose 1.1.

New stable features and API

Image vector cache

Compose 1.1 introduced the Image vector cache, which brought huge performance improvements. We added a caching mechanism to the painterResource API to cache all ImageVectors instances resolved with a given resource ID and topic. The cache will be invalidated on configuration changes.

touch target value

With respect to Compose 1.0, the Material component will expand its layout space to meet the touch target value requirement of the Material Accessibility Guidelines . For example, even if you downsize the RadioButton , the size of the RadioButton's touch target will still expand to at least 48x48dp. This will align the behavior of Compose Material with Material Design components to provide consistent behavior when mixing View and Compose. This change also ensures that the minimum touch target accessibility requirements are met when you use Compose Material components to create your interface.

If you find that this change breaks existing layout logic, disable this behavior by setting LocalMinimumTouchTargetEnforcement ) to false, but this action may reduce the usability of your app, so you need to be careful and use it sparingly.

△ RadioButton 触摸目标更新 左: Compose 1.0,右: Compose 1.1

△ RadioButton touch target update Left: Compose 1.0, Right: Compose 1.1

API from experimental to stable

Some APIs transitioned from experimental to stable. mainly includes:

New experimental API

We're always adding new features to Compose, including the following highlights:

  • You can save and restore AnimatedContent rememberSaveable
  • You can use Modifier.animateItemPlacement() .animateItemPlacement(androidx.compose.animation.core.FiniteAnimationSpec)) to animate the LazyColumn/LazyRow item position.
  • You can use the new BringIntoView API to send a request to the parent so that the parent scrolls, bringing the item into view.

You can use @OptIn to try out these brand new APIs and give us your feedback!

Note: Kotlin 1.6.10 is required to use Compose 1.1. For more information, you can check Compose Compose with Kotlin Compatibility Correspondence .

Wondering about future plans? You can check out 's latest roadmap for features we're currently evaluating and developing, such as lazy-loading item animations, downloadable fonts, movable content, and more!

Jetpack Compose is now in a stable release for everyone to use in production, and will continue to add the features you want. We're excited to see thousands of apps already using Jetpack Compose in production, and we can't wait to see what you'll be building!

We appreciate the bug reports and feature requests submitted by developers through the issue tracker page during Alpha and Beta, helping us improve Compose and build the API you need. You are welcome to continue to share your feedback with us and help us make Compose even better! You are also welcome to continue to pay attention to the "Android Developer" WeChat public account for more latest content.

You are welcome Click here to submit feedback to us, or share your favorite content and problems found. Your feedback is very important to us, thank you for your support!


Android开发者
404 声望2k 粉丝

Android 最新开发技术更新,包括 Kotlin、Android Studio、Jetpack 和 Android 最新系统技术特性分享。更多内容,请关注 官方 Android 开发者文档。