Introduction
Hi friends!! In this article, we will learn about Column and Row in Jetpack Compose. Row and Column are the essential core component of a jetpack compose. We can customize our screen using Column and Row easily. If you are Flutter Developer so you already know about Row and Column. In Jetpack Compose, Row and Column are exactly work the same as in Flutter. Row and Column are really good composable functions to customize our screen UI easily. Let's understand these concepts in an easy way -
Column
In Jetpack Compose, Column is a composable function used to arrange its child vertically, similar to how a vertical Linear Layout works in traditional Android. You can consider a Column as a vertical container that holds other composables. This makes it easy to create vertical layouts for your UI.
In the Column, One of the important property is the vertical arrangement. The Arrangement parameter is used to define the alignment and spacing between the child composables. Different vertical arrangements in Column -

Source:- "Android"
Syntax
@Composable
fun VerticalLayout() {
Column {
// First child composable
// ...
// Second child composable
// ...
// Third child composable
// ...
}
}
Example
Let's suppose we want to show a list of contact and each content have a name and mobile number and our requirement is the name and mobile number should be arranged in vertical order. To achieve this requirement we are going to use Column in below solution.
@Composable
fun ContactList(){
LazyColumn(
content = {
item{
EachContact("Abhishek From India","+91123456789")
}
item{
EachContact("Gaurav From USA","+1(645)111-1234")
}
item{
EachContact("Harshit From Dubai","+1(645)111-1234")
}
item{
EachContact("Avin From Abu Dhabi","+9711233333")
}
}
)
}
@Composable
fun EachContact(name: String,contactNo:String) {
Column(
Modifier.padding(20.dp)
) {
Text(text = name)
Spacer(modifier = Modifier.height(5.dp))
Text(text = contactNo)
}
}
Output


Join the conversation! Your thoughts help the community grow.