Row and Column in Jetpack Compose
What is Row?
What is Column?
Click to learn more about Layout in Jetpack Compose
package com.example.jetpackcomposeskcoding
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
@Composable
fun ComposeLayout() {
Column (
Modifier.verticalScroll(rememberScrollState()).fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceAround){
Box(Modifier.size(120.dp).background(Color.Yellow))
Box(Modifier.size(120.dp).background(Color.Magenta))
Box(Modifier.size(120.dp).background(Color.Red))
Box(Modifier.size(120.dp).background(Color.Green))
Box(Modifier.size(120.dp).background(Color.Blue))
Box(Modifier.size(120.dp).background(Color.Cyan))
Box(Modifier.size(120.dp).background(Color.Yellow))
Box(Modifier.size(120.dp).background(Color.Magenta))
Box(Modifier.size(120.dp).background(Color.Red))
Box(Modifier.size(120.dp).background(Color.Green))
Box(Modifier.size(120.dp).background(Color.Blue))
Box(Modifier.size(120.dp).background(Color.Cyan))
}
}
@Composable
fun ComposeLayout() {
Row {
Text(text = "Row Item One")
Text(text = "Row Item Tow")
Text(text = "Row Item Three")
Text(text = "Row Item Four")
Text(text = "Row Item Five")
Text(text = "Row Item One")
Text(text = "Row Item Tow")
Text(text = "Row Item Three")
Text(text = "Row Item Four")
Text(text = "Row Item Five")
}
}
