Chapter 18. Jetpack Compose: Compose Yourself
All the UIs youâve built so far have used views and layout files.
But with Jetpack Compose, thatâs not the only option. In this chapter, weâre going to take a road trip to Composeville, and find out how to build UIs using Compose components called composables instead of views. Youâll learn how to use built-in composables such as Text, Image, TextField, and Button. Youâll discover how to arrange them in Rows and Columns, and style them using themes. Youâll write and preview your own composable functions. Youâll even find out how to manage a composableâs state using MutableState objects. Turn the page, and letâs get composingâ¦
UI components donât have to be Views
So far in this book, youâve learned how to use layout files and views to build swish, interactive UIs. But while weâve focused on this approach, itâs not your only option.
An alternative is to build your UI using Jetpack Compose. Compose is part of Android Jetpack; itâs an entire toolkit of libraries, tools, and APIs designed to help you build native UIs with pure Kotlin code.
The great news is that using Jetpack Compose builds on your existing Android knowledge. You can use view models and live data with Compose, for example, and even add Compose components to existing UIs.
Note
Youâll find out more about this in the next chapter.
Weâre ...
Get Head First Android Development, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.