
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
DefaultTheme { | |
// A surface container using the 'background' color from the theme | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colorScheme.background | |
) { | |
MyTempText() | |
} | |
} | |
} | |
} | |
} | |
@Composable | |
fun MyTempText(){ | |
Column() { | |
MyTempText3 { | |
Text( | |
text = "안녕", | |
fontSize = 100.sp, | |
color = Color.Red | |
) | |
} | |
MyTempText3 { | |
Text( | |
text = "나는", | |
fontSize = 30.sp, | |
color = Color.Green | |
) | |
} | |
MyTempText3 { | |
Text( | |
text = "누구누구야", | |
fontSize = 30.sp, | |
color = Color.Gray | |
) | |
} | |
// MyTempText2( | |
// text = "안녕", | |
// fontSize = 30.sp, | |
// color = Color.Red | |
// ) | |
// MyTempText2( | |
// text = "나는", | |
// fontSize = 30.sp, | |
// color = Color.Green | |
// ) | |
// MyTempText2( | |
// text = "누구누구야", | |
// fontSize = 30.sp, | |
// color = Color.Gray | |
// ) | |
// Text( | |
// text = "안녕", | |
// fontSize = 30.sp, | |
// color = Color.Red | |
// ) | |
// Text( | |
// text = "나는", | |
// fontSize = 30.sp, | |
// color = Color.Green | |
// ) | |
// Text( | |
// text = "누구누구야", | |
// fontSize = 30.sp, | |
// color = Color.Gray | |
// ) | |
} | |
} | |
@Composable | |
fun MyTempText2(text : String, fontSize : TextUnit, color : Color){ | |
Text( | |
text = text, | |
fontSize = fontSize, | |
color = color | |
) | |
} | |
@Composable | |
fun MyTempText3(content : @Composable () -> Unit){ | |
content() | |
} | |
@Preview(showBackground = true) | |
@Composable | |
fun GreetingPreview() { | |
DefaultTheme { | |
MyTempText() | |
} | |
} |
'Compose' 카테고리의 다른 글
Naviagation -1 (0) | 2023.06.11 |
---|---|
show hide (0) | 2023.06.10 |
LinearProgressIndicator (0) | 2023.06.06 |
lazyrow (0) | 2023.06.04 |
surface (0) | 2023.06.03 |