안드로이드 학습(Compose)/Compose로 날씨 앱 재구성하기
메인화면 상단 텍스트, 이미지 레이아웃 구성
리저브콜드브루
2025. 3. 7. 13:26
728x90
반응형
@Composable
fun MainScreen()
{
TopWeatherInfo()
}
@Composable
fun TopWeatherInfo()
{
Column {
Text(
text = "현 위치"
)
TopWeatherInfoSection(weatherIcon = R.drawable.sunny_128, temperature = "10")
}
}
@Composable
fun TopWeatherInfoSection(weatherIcon: Int, temperature: String)
{
Row(modifier = Modifier.padding(16.dp)) {
Image(
painterResource(id = weatherIcon),
contentDescription = "Weather Icon",
modifier = Modifier.width(80.dp)
)
Spacer(modifier = Modifier.width(16.dp))
Text(
text = "$temperature℃",
fontSize = 60.sp,
fontWeight = FontWeight.Bold
)
}
}
728x90
반응형