MainActivity.kt
// Row
// Item1 Item2 Item3
// Column
// Item1
// Item2
// Item3
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
DefaultTheme {
RowTest()
}
}
}
}
@Composable
fun RowTest(){
Row(
modifier = Modifier.fillMaxSize().background(Color.Gray),
horizontalArrangement = Arrangement.SpaceEvenly, // 가로로 동일한 간격
verticalAlignment = Alignment.CenterVertically
){
Text(
text = "Item1",
style = TextStyle(background = Color.Blue),
fontSize = 30.sp
)
Text(
text = "Item2",
style = TextStyle(background = Color.Red),
fontSize = 30.sp
)
Text(
text = "Item3",
style = TextStyle(background = Color.Green),
fontSize = 30.sp
)
}
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
DefaultTheme {
RowTest()
}
}