Expanding the App

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Refactor Into Separate Composables

In your project, open MainActivity.kt. Look through the code — where is the @Composable annotation?

Layout Groups

Layout Groups in Compose allow you to arrange elements of your UI on the device screen in various ways. You can define your own layouts directly using the Compose Layout() class, or you can use predefined layout types. Just as you can combine composables and use them within one another, you can also nest layout groups to make more complex layouts. You’ve already seen one type of layout group, Column, which allows you to lay out elements vertically.

Previews

Open KodecochatAppBar.kt. At the top of Android Studio, beneath the run and debug icons, click the icon for split view, which is a combination of the code and design views:

More With Modifiers

You learned in the last lesson that modifiers tell a UI element how to lay out, display, or behave within its parent layout, and you started using modifiers to style the app.

Lists

What happens when you have to display more elements than you can fit on the screen? In that case, while the elements are all composed, the limited screen size prevents you from seeing all of them. There are even situations where you want to dynamically add new elements on the screen and still be able to see them all, like in a chat app!

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo