Category: Jetpack Compose

  • A Compose Lazy Staggered Grid Tutorial

    The chapter Jetpack Compose Lists and Grids introduced the horizontal and vertical lazy grid composables and demonstrated how they could be used to organize items in rows and columns. However, a limitation of these layouts is that the grid cells are the same size. While this may be the desired behavior for many grid implementations,…

  • Jetpack Compose Sticky Headers and Scroll Detection

    In the previous chapter, we created a project that makes use of the LazyColumn layout to display a list of Card components containing images and text. The project also implemented clickable list items which display a message when tapped. This chapter will extend the project both to include sticky header support and to use scroll…

  • A Jetpack Compose Lazy List Tutorial

    Although the creation of lists using the standard compose Row and Column layout composables was covered in the previous chapter, in most situations you will be more likely to make use of the LazyColumn and LazyRow components. Not only do these provide a more efficient way to display long lists of items, but the lazy…

  • A Jetpack Compose Row and Column List Tutorial

    In this chapter, we will create a project that makes use of the Column and Row components to display items in a list format. In addition to creating the list, the tutorial will also enable scrolling and provide a demonstration of programmatic scrolling. Creating the ListDemo project Launch Android Studio and select the New Project…

  • Jetpack Compose Lists and Grids

    It is a common requirement when designing user interface layouts to present information in either scrollable list or grid configurations. For basic list requirements, the Row and Column components can be re-purposed to provide vertical and horizontal lists of child composables. Extremely large lists, however, are likely to cause degraded performance if rendered using the…

  • Coroutines and LaunchedEffects in Jetpack Compose

    When an Android application is first started, the runtime system creates a single thread in which all application components will run by default. This thread is generally referred to as the main thread. The primary role of the main thread is to handle the user interface in terms of event handling and interaction with views…

  • A Jetpack Compose IntrinsicSize Tutorial

    As we already know from the previous chapters, one of the ways that Compose can render user interface layouts quickly and efficiently is by limiting each composable to being measured only once during a recomposition operation. Situations sometimes arise, however, where a parent composable needs to know size information about its children before they are…

  • Jetpack Compose ConstraintLayout Examples

    In the previous chapter, we introduced ConstraintLayout and explained how the key features of this layout manager can be used to create complex and responsive user interface designs. This chapter will describe how ConstraintLayout is used within Compose layouts while providing example implementations of the various ConstraintLayout features you can combine to design your layouts.…

  • Building Custom Layouts in Jetpack Compose

    So far in this book, we have introduced the Box, Column, and Row layout components provided with Compose and shown how these are used to layout child elements in an organized way. We have also covered the creation and use of custom layout modifiers and explored how these can be used to modify the position…

  • Custom Layout Modifiers in Jetpack Compose

    Although the Box, Row, and Column composables provide a great deal of flexibility in terms of layout design, situations will inevitably arise where you have a specific layout requirement that cannot be achieved using the built-in layout components. Fortunately, Compose includes several more advanced layout options. In this chapter, we will explore one of these…