๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
728x90

์ „์ฒด ๊ธ€140

์ฒซ Android ์•ฑ ๋งŒ๋“ค๊ธฐ 6. ๋ฐฐ๊ฒฝ ์ƒ‰์ƒ ๋ณ€๊ฒฝ import ์‹œ ์•ŒํŒŒ๋ฒณ ์ˆœ์œผ๋กœ ํ•˜๋Š” ๊ฒŒ ์ข‹๋‹ค. help - find action - Optimize Imports ํด๋ฆญ @Composable fun Greeting(name: String) { Surface(color = Color.Magenta) { Text(text = "Hello my name is $name!") } } 7. ํŒจ๋”ฉ ์ถ”๊ฐ€ ํ…์ŠคํŠธ ์ฃผ์œ„์— ๊ณต๋ฐฑ(ํŒจ๋”ฉ)์„ ์ถ”๊ฐ€ํ•ด๋ณด์ž @Composable fun Greeting(name: String) { Surface(color = Color.Magenta) { Text(text = "Hi, my name is $name!", modifier = Modifier.padding(24.dp)) } } Modifier๋Š” ์ปดํฌ์ €๋ธ”์„ ๊ฐ•ํ™”ํ•˜๊ฑฐ.. 2022. 11. 15.
์ฒซ ๋ฒˆ์งธ Android ์•ฑ ๋งŒ๋“ค๊ธฐ 5 5) ํ…์ŠคํŠธ ์—…๋ฐ์ดํŠธ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { GreetingCardTheme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background ) { Greeting("Android") } } } } } onCreate() ํ•จ์ˆ˜๋Š” ์ด ์•ฑ์˜ ์ง„์ž…์ ์œผ๋กœ ๋‹ค๋ฅธ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ.. 2022. 11. 15.
์—ฐ์Šต๋ฌธ์ œ ๋ฉ”์‹œ์ง€ ์ธ์‡„ fun main() { println("Use the val keyword when the value doesn't change.") println("Use the var keyword when the value can change.") println("When you define a function, you define the parameters that can be passed to it.") println("When you call a function, you pass arguments for the parameters.") } ์ปดํŒŒ์ผ ์˜ค๋ฅ˜ ์ˆ˜์ • fun main() { println("New chat message from a friend'} } fun main() { println(".. 2022. 11. 15.
์•ˆ๋“œ๋กœ์ด๋“œ ์Šคํ„ฐ๋”” 1์ผ์ฐจ ๊ณผ์ œ unit1 Mainํ•จ์ˆ˜ mainํ•จ์ˆ˜๋ž€ ์ฝ”๋“œ์—์„œ Kotlin ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ์‹œ์ž‘๋˜๋Š” ํŠน์ • ์œ„์น˜์ž…๋‹ˆ๋‹ค. mainํ•จ์ˆ˜๋Š” ํ”„๋กœ๊ทธ๋žจ์˜ ์ง„์ž…์  ๋˜๋Š” ์‹œ์ž‘์ ์ž…๋‹ˆ๋‹ค. ํ•จ์ˆ˜๋ž€? Kotlin ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ ํ•จ์ˆ˜์˜ ์ด๋ฆ„์€ ์นด๋ฉœ ํ‘œ๊ธฐ๋ฒ•์œผ๋กœ!, ๋™์‚ฌ ๋˜๋Š” ๋™์‚ฌ๊ตฌ ๊ฐ ๋ฌธ์€ ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ์ž…๋ ฅ ์—ฌ๋Š” ์ค‘๊ด„ํ˜ธ๋Š” ํ•จ์ˆ˜๊ฐ€ ์‹œ์ž‘๋˜๋Š” ์ค„์˜ ๋์— ํ‘œ์‹œ ์—ฌ๋Š” ์ค‘๊ด„ํ˜ธ ์•ž์—๋Š” ๊ณต๋ฐฑ์ด ์žˆ์–ด์•ผ ํ•œ๋‹ค. ํ•จ์ˆ˜ ๋ณธ๋ฌธ ์ž‘์„ฑ ์‹œ Tab์œผ๋กœ ๋“ค์—ฌ์“ฐ๊ธฐ ํ•˜์ง€ ๋ง ๊ฒƒ! ๊ณต๋ฐฑ 4๊ฐœ๋ฅผ ์ž…๋ ฅํ•˜๊ธฐ ๋‹ซ๋Š” ์ค‘๊ด„ํ˜ธ๋Š” ํ•จ์ˆ˜ ์‹œ์ž‘๋ถ€๋ถ„์— ์žˆ๋Š” funํ‚ค์›Œ๋“œ๋กœ ์ •๋ ฌ๋˜๋„๋ก ํ•˜๊ธฐ fun main() { println("Hello, world!") } 2022. 11. 15.
728x90