Basics of Jetpack Compose in Android (original) (raw)

Last Updated : 23 Jul, 2025

**Jetpack Compose is a modern UI toolkit that is designed to simplify UI development in Android. It consists of a reactive programming model with conciseness and ease of Kotlin programming language. It is fully declarative so that you can describe your UI by calling some series of functions that will transform your data into a UI hierarchy. When the data changes or is updated then the framework automatically recalls these functions and updates the view for you. In this article, we will see some of the basic topics which are helpful before starting with Jetpack Compose.

What is Jetpack Compose?

Jetpack Compose is a modern UI toolkit recently launched by Google which is used for building native Android UI. It simplifies and accelerates the UI development with less code, Kotlin APIs, and powerful tools.

What are the Benefits of Using Jetpack Compose?

What Challenges Do We Can Solve using Jetpack Compose?

Some Basic Functions of Jetpack Compose

  1. **Composable Function: Composable Function is represented in code by using @Composable annotation to the function name. This function will let you define your app's UI programmatically by describing its shape and data dependencies rather than focusing on the UI construction process.
  2. **Preview Function: The name of the function itself tells us that the function is used to generate the preview of the composable function. It is used to display a preview of our composable functions within our IDE rather than installing our APK in an emulator or a virtual device. The preview function is annotated by @Preview.
  3. **Column Function: The column function is used to stack UI elements in a vertical manner. This function will stack all the children directly one after another in a vertical manner with no spacing between them. It is annotated with **Column().
  4. **Row Function: The row function is used to stack UI elements in a horizontal manner. This function will stack all the children one after the other in a horizontal manner with no spacing between them. It is annotated with **Row().
  5. **Box: A widget that is used to positioned elements one over another. It will position its children relative to its edges. The stack is used to draw the children which will overlap in the order that they are specified. It is annotated with **Box().
  6. **Spacer: It is used to give spacing between two views. We can specify the height and width of the box. It is an empty box that is used to give spacing between the views. It is annotated with **Spacer().
  7. **Vertical Scroll: If the UI components inside the app do not fit the height of the screen then we have to use the scrolling type of view. With the help of a vertical scroller, we can provide a vertically scrolling behavior to our view. The contents inside the vertical scroller will be clipped to the bounds of the vertical scroller. It is annotated with VerticalScroll().
  8. **Padding: The padding function is used to provide extra white space according to the requirement around the specific view. It is simply annotated with **Padding().
  9. **Lazy List: This composable is equivalent to a recycler view in android's view system. It is annotated with LazyColumn().

To Learn more about Topic Check Android Jetpack Compose Tutorial