Posted by jolanda verhofAndroid Developer Relations Engineer
today, as part of Compose the March ’23 Bill of MaterialsWe are releasing version 1.4 jetpack designAndroid’s modern, native UI toolkit which is used by apps Like Booking.com and Airbnb. This release includes new features such as pager And flow layoutand new ways to style your text, like hyphenation And line-break behavior, It also improves modifier performance and fixes several bugs.
Swipe through content with the composable new pager
write is now included Out-of-the-box support for vertical and horizontal paging between different materials. using the vertical pager Or horizontal pager Enables functionality similar to view pager in the visual system. However, like the benefits of using LazyRow And lazy columnYou No need to make adapters or pieces anymore, You can just embed a composeable inside pager,
Get your content flowing with the new Flow Layout
fluoro And flow column provide a efficient and compact way Placing items in a container when the size of the item or container is unknown or dynamic. These containers allow items to flow to the next line. fluoro or in the next column flow column when their place expires. These flow layouts also allow for dynamic sizing by using weights to distribute items in the container.
Here’s an example that implements a list of filters for a Real Estate app:
Improve performance in modifiers
The major internal modifier refactoring we started in the October release continues Migration of multiple basic modifiers to new modifier. node architecture. this also includes graphics layerlow level focus modifier, cushion, offset, even more. This refactoring should improve the performance of these APIs, and you should not need to change your code to get these benefits. This is a work in progress, and we expect even more benefits in future releases as we migrate the modifier out UI modulus. Learn more about the reason behind the changes in ADS Talk Write Modifiers Deep Dive,
increased flexibility of Basic lesson And text field
With various performance improvements, API stabilization and bug fixes, write text 1.4 release brings support for latest emoji version🎉🙌, including backward compatibility with older Android versions. No changes are required to your application to support it. If you are using a custom emoji solution, be sure to check PlatformTextStyle(emojiSupportMatch),
In addition, we have addressed one of the main pain points of using text field, In some scenarios, a text field inside a scrollable column Or lazy column Once focused, the on-screen keyboard will be obscured. We core parts reworked scroll and focus logic keys, and Major APIs Added Like pinnable container To fix this bug.
Lastly, we’ve added tons of new customization options to Basic lesson And its text style,
- Drag underlined text using the Text Style. draw style,
- improve text Transitions and readability during animations using the textstyle.textmotion,
- configure line breaking behavior using the text style.line break, Use built-in semantic configuration like Topic, paragraphOr Easyor build your own line break configuration with desired strategy, strictnessAnd wordbreak Value.
- Add hyphenation support using the text style.hyphen,
- define a minimum number of visible lines Using the minLines parameter of Basic lesson And text field Composition.
- move your text by applying basic marker modifier. As a bonus, since it’s a modifier, you can apply it to any arbitrary combination to make them move in similar marquee-like fashion!
|Marquee text using outlines that are stamped using shapes drawStyle API.|
Improvements and fixes to core features
In response to developer feedback, we’ve ported some particularly sought-after features and bug fixes to our core libraries:
- Examination wait until now accepts A matcher! you can use this api Synchronize your tests with your UI easilyWith specific terms that you define.
- animated content now supports interrupt correctly and returns to its former state.
- accessibility services Focus order has been improved: The the sequence is more logical now In common situations, such as with up/down bars.
- Android View is now reusable In lazy list If you provide an alternative on reset lambda. This improvement lets you use complex non-composition-based views inside lazy lists,
- Color.lerp display has been improved and now does zero allocation: Since this method is called at a higher frequency during fade animations, this should reduce the amount of pauses for garbage collection, especially on older Android versions.
- many others minor api and bug fixes As part of a general cleaning. For more information, see release notes,
We are grateful for all bug reports and feature requests submitted to us issue tracker – They help us improve by writing and building the APIs you need. Keep giving your feedback and help us make Compose better!
Wondering what’s next? check our updated roadmap To see the features we’re thinking of and working on right now. We can’t wait to see what you create next!