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

2023 ์•ˆ๋“œ๋กœ์ด๋“œ23

4.Compose ์‚ฌ๋ถ„๋ฉด ์ด๊ฒƒ์„ ๊ตฌํ˜„ํ•ด์•ผํ•œ๋‹ค. ์–ด๋ ค์›Œ ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ ๊ทผ๋ฐ modifier = Modifier .weight(1f,false).background(Color.Green) .padding(top = 16.dp, end = 16.dp, bottom = 16.dp, start = 16.dp) .fillMaxWidth( ์—ฌ๊ธฐ์„œ weight ์˜ค๋ฅ˜๊ฐ€ ๋œฌ๋‹ค. import๋ฅผ ํ•ด๋„ ์™œ ๋นจ๊ฐ„ ์„ ์ด ์•ˆ์—†์–ด์ง€์ง€........ ์†”๋ฃจ์…˜ ์ฝ”๋“œ /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in complianc.. 2022. 11. 17.
์—ฐ์Šต: Compose ๊ธฐ๋ณธ ์‚ฌํ•ญ 1 ) MainActivity.kt package com.example.learntogether import android.os.Bundle import android.text.style.TextAppearanceSpan import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.Image import androidx.compose.foundation.layout.* import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import android.. 2022. 11. 17.
10. ์†”๋ฃจ์…˜ ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐ ~ 11. ๊ฒฐ๋ก  GitHub์˜ ๋ถ„๊ธฐ ์ €์žฅ์†Œ: ์ปดํ“จํ„ฐ์— ํด๋ก (๋ณต์‚ฌ)ํ•˜๋Š” ์ „์ฒด ํ”„๋กœ์ ํŠธ(๋””๋ ‰ํ„ฐ๋ฆฌ ๋ฐ ํŒŒ์ผ)์ž…๋‹ˆ๋‹ค. ๋ธŒ๋žœ์น˜๋Š” ์ €์žฅ์†Œ์˜ ๋ฒ„์ „, ์ฆ‰ ๋…๋ฆฝ์ ์ธ ๊ฐœ๋ฐœ๋ผ์ธ์ด๋‹ค. ์˜ˆ๋ฅผ ์ผ๋” ์ด ๊ณผ์ •์—์„œ starter ๋ถ„๊ธฐ๋Š” Codelab์„ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ๊ธฐ์ดˆ๋กœ ์‚ฌ์šฉํ•œ ํ”„๋กœ์ ํŠธ์˜ ๋ฒ„์ „์ด ๋  ์ˆ˜ ์žˆ๋‹ค. ~ ์ดํ›„ ๋‹ค์‹œ ์ฝ๊ธฐ ๊ฒฐ๋ก  Android ์ŠคํŠœ๋””์˜ค์˜ Resource Mangager ํƒญ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ด๋ฏธ์ง€์™€ ๊ธฐํƒ€ ๋ฆฌ์†Œ์Šค๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. Image ์ปดํฌ์ €๋ธ”์€ ์•ฑ์— ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•˜๋Š” UI์š”์†Œ์ด๋‹ค. Image ์ปดํฌ์ €๋ธ”์€ ์ฝ˜ํ…์ธ  ์„ค๋ช…์ด ์žˆ์–ด์•ผ ์•ฑ์ด ์ ‘๊ทผ์„ฑ์ด ๋†’์•„์ง„๋‹ค. ์ƒ์ผ ์ถ•ํ•˜ ๋ฉ”์‹œ์ง€์™€ ๊ฐ™์€ ์‚ฌ์šฉ์ž์—๊ฒŒ ํ‘œ์‹œ๋˜๋Š” ํ…์ŠคํŠธ๋Š” ์•ฑ์„ ๋‹ค๋ฅธ ์–ธ์–ด๋กœ ์‰ฝ๊ฒŒ ๋ฒˆ์—ญํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค๋กœ ์ถ”์ถœํ•ด์•ผํ•œ๋‹ค. 2022. 11. 16.
Android ์•ฑ์— ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ [ ๋„์ „๊ณผ์ œ ] stringResource stringResource ๋ž‘ getString ์ €๋ ‡๊ฒŒ ํ•˜๋ฉด HappyBirthdayTheme { // A surface container using the 'background' color from the theme Surface(color = MaterialTheme.colors.background){ BirthdayGreetingWithImage(stringResource(R.string.happy_birthday_text), from = getString( R.string.signature_text)) } } getString( )์œผ๋กœ ๋‚˜์˜ค๋Š”๋ฐ ์™œ์ง€? HappyBirthdayTheme { // A surface container using the 'background' .. 2022. 11. 16.
728x90