Ver3.0 ๐ ์๋๋ก์ด๋ ๋คํฌ ํ ๋ง ๊ตฌํ๊ณผ ๋์: ์ฌ์ฉ์ ๊ฒฝํ์ ํ ๋จ๊ณ ์ ๊ทธ๋ ์ด๋ํ๋ ์๋ฒฝ ๊ฐ์ด๋

๐ ์๋๋ก์ด๋ ๋คํฌ ํ ๋ง ๊ตฌํ๊ณผ ๋์: ์ฌ์ฉ์ ๊ฒฝํ์ ํ ๋จ๊ณ ์ ๊ทธ๋ ์ด๋ํ๋ ์๋ฒฝ ๊ฐ์ด๋
๋ฐค์๋ ๋์ด ํธ์ํ ์ฑ์ ๋ง๋ค์ด๋ณด์! ๋คํฌ ํ ๋ง์ ๋ชจ๋ ๊ฒ
์๋
! ๐ ์์ฆ ๋ฐค์ ์ค๋งํธํฐ ๋ณด๋ค๊ฐ ๋์ด ๋๋ฌด ๋ถ์
์ ํ๋ฉด ๋ฐ๊ธฐ๋ฅผ ์ต์๋ก ๋ฎ์ถฐ๋ณธ ๊ฒฝํ ์์ง? ๊ทธ๋ฐ๋ฐ ๋ฐ๊ธฐ๋ฅผ ๋ฎ์ถฐ๋ ํ์ ๋ฐฐ๊ฒฝ์ ์ฌ์ ํ ๋์ ํผ๊ณคํ๊ฒ ๋ง๋ค์ด. ๋ฐ๋ก ์ด๋ฐ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ฑ์ฅํ ๊ฒ ๋คํฌ ํ
๋ง์ผ! ๐
์๋๋ก์ด๋ 10(API 29)๋ถํฐ ๊ณต์์ ์ผ๋ก ๋คํฌ ํ
๋ง๊ฐ ์ง์๋๋ฉด์, ์ด์ ๋ ๊ฑฐ์ ๋ชจ๋ ์ฑ์์ ๋คํฌ ๋ชจ๋๋ฅผ ์ ๊ณตํ๊ณ ์์ด. ์ ํ๋ธ, ์ธ์คํ๊ทธ๋จ, ์นด์นด์คํก๊น์ง ๋ง์ด์ผ. ์ฌ์ฉ์๋ค์ ์ด์ ๋คํฌ ํ
๋ง๋ฅผ ๋น์ฐํ๊ฒ ๊ธฐ๋ํ๊ณ ์๊ณ , ๊ฐ๋ฐ์๋ก์ ์ด๋ฅผ ์ ๋๋ก ๊ตฌํํ๋ ๊ฑด ์ ํ์ด ์๋๋ผ ํ์๊ฐ ๋์์ง.
์ด ๊ธ์์๋ ์๋๋ก์ด๋ ์ฑ์์ ๋คํฌ ํ
๋ง๋ฅผ ์ด๋ป๊ฒ ๊ตฌํํ๋์ง, ์ด๋ค ์ ๋ค์ ์ฃผ์ํด์ผ ํ๋์ง, ๊ทธ๋ฆฌ๊ณ ์ค์ ๋ก ์ ์ฉํ ๋ ๋ง์ฃผ์น๋ ๋ค์ํ ๋ฌธ์ ๋ค๊ณผ ํด๊ฒฐ ๋ฐฉ๋ฒ๊น์ง ์น๊ตฌ์ฒ๋ผ ํธํ๊ฒ ์๋ ค์ค๊ฒ! ๐
๐ฏ ๋คํฌ ํ ๋ง๊ฐ ์ ์ค์ํ ๊น?
๋คํฌ ํ ๋ง๋ ๋จ์ํ "๊ฒ์์ ๋ฐฐ๊ฒฝ"์ ์๋ฏธํ๋ ๊ฒ ์๋์ผ. ์ฌ์ฉ์ ๊ฒฝํ(UX)์ ๊ทผ๋ณธ์ ์ผ๋ก ๊ฐ์ ํ๋ ๊ฐ๋ ฅํ ๋๊ตฌ์ง! ์ ์ด๋ ๊ฒ ๋ง์ ์ฑ๋ค์ด ๋คํฌ ํ ๋ง๋ฅผ ๋์ ํ๊ณ ์๋์ง ๊ทธ ์ด์ ๋ฅผ ์ดํด๋ณด์. ๐ก
๐ฑ ๋์ ํผ๋ก ๊ฐ์
๋ฐค์ ์นจ๋์ ๋์์ ์ค๋งํธํฐ์ ๋ณผ ๋๋ฅผ ์๊ฐํด๋ด. ์ด๋์ด ๋ฐฉ์์ ๋ฐ์ ํ๋ฉด์ ๋ณด๋ฉด ๋์ด ์์ฒญ ํผ๊ณคํ์ง? ๋คํฌ ํ
๋ง๋ ํ๋ฉด์์ ๋์ค๋ ๋น์ ์์ ํฌ๊ฒ ์ค์ฌ์ ๋์ ํผ๋ก๋ฅผ ๋์ด์ค. ํนํ OLED ๋์คํ๋ ์ด์์๋ ๊ฒ์์ ํฝ์
์ด ์์ ํ ๊บผ์ง๊ธฐ ๋๋ฌธ์ ํจ๊ณผ๊ฐ ๋ ํฌ์ง! ๐
์ฐ๊ตฌ์ ๋ฐ๋ฅด๋ฉด ์ด๋์ด ํ๊ฒฝ์์ ๋คํฌ ํ
๋ง๋ฅผ ์ฌ์ฉํ๋ฉด ๋์ ํผ๋ก๊ฐ ์ต๋ 60%๊น์ง ๊ฐ์ํ๋ค๊ณ ํด. ์ฅ์๊ฐ ์ฑ์ ์ฌ์ฉํ๋ ์ฌ์ฉ์๋ค์๊ฒ๋ ์ ๋ง ์ค์ํ ๊ธฐ๋ฅ์ด์ผ.
๐ ๋ฐฐํฐ๋ฆฌ ์๋ช ์ฐ์ฅ
OLED๋ AMOLED ๋์คํ๋ ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ธฐ๊ธฐ์์๋ ๋คํฌ ํ
๋ง๊ฐ ๋ฐฐํฐ๋ฆฌ ์ ์ฝ์ ์์ฒญ๋ ๋์์ด ๋ผ. ์๋ํ๋ฉด ์ด๋ฐ ๋์คํ๋ ์ด๋ ๊ฒ์์์ ํ์ํ ๋ ํด๋น ํฝ์
์ ์์ ํ ๋๊ธฐ ๋๋ฌธ์ด์ผ! ๐
๊ตฌ๊ธ์ ์คํ ๊ฒฐ๊ณผ์ ๋ฐ๋ฅด๋ฉด, ํฝ์
ํฐ์์ ๋คํฌ ํ
๋ง๋ฅผ ์ฌ์ฉํ๋ฉด ์ต๋ ๋ฐ๊ธฐ์์ ์ฝ 60%์ ์ ๋ ฅ์ ์ ์ฝํ ์ ์๋ค๊ณ ํด. ํ๋ฃจ ์ข
์ผ ์ค๋งํธํฐ์ ์ฌ์ฉํ๋ ํ๋์ธ๋ค์๊ฒ๋ ์ ๋ง ๋งค๋ ฅ์ ์ธ ๊ธฐ๋ฅ์ด์ง!
๐จ ์๊ฐ์ ๊ณ์ธต ๊ตฌ์กฐ ๊ฐํ
๋คํฌ ํ ๋ง๋ ์ฝํ ์ธ ์ ๋ ์ง์คํ๊ฒ ๋ง๋ค์ด์ค. ์ด๋์ด ๋ฐฐ๊ฒฝ ์์ ๋ฐ์ ์์์ ์์๋ค์ด ๋์ฑ ๋๋ณด์ด๋ฉด์ ์๊ฐ์ ๊ณ์ธต ๊ตฌ์กฐ๊ฐ ๋ช ํํด์ง๊ฑฐ๋ . ํนํ ์ฌ์ง์ด๋ ๋น๋์ค ๊ฐ์ ๋ฏธ๋์ด ์ฝํ ์ธ ๋ฅผ ๋ค๋ฃจ๋ ์ฑ์์๋ ๋คํฌ ํ ๋ง๊ฐ ์ฝํ ์ธ ๋ฅผ ๋์ฑ ๋๋ณด์ด๊ฒ ๋ง๋ค์ด์ค! ๐ผ๏ธ
โฟ ์ ๊ทผ์ฑ ํฅ์
์๊ฐ ์ฅ์ ๋ ๊ด๊ณผ๋ฏผ์ฑ์ ๊ฐ์ง ์ฌ์ฉ์๋ค์๊ฒ ๋คํฌ ํ ๋ง๋ ํ์์ ์ด์ผ. ๋ฐ์ ๋น์ ๋ฏผ๊ฐํ ์ฌ๋๋ค์ ๋คํฌ ํ ๋ง๋ฅผ ํตํด ํจ์ฌ ํธ์ํ๊ฒ ์ฑ์ ์ฌ์ฉํ ์ ์์ด. ์ด๋ ๋จ์ํ ํธ์์ฑ์ ๋์ด์ ํฌ์ฉ์ ์ธ ๋์์ธ์ ํต์ฌ ์์์ง! ๐
๐ ๏ธ ์๋๋ก์ด๋ ๋คํฌ ํ ๋ง ๊ตฌํ์ ๊ธฐ๋ณธ ์๋ฆฌ
์, ์ด์ ๋ณธ๊ฒฉ์ ์ผ๋ก ๋คํฌ ํ ๋ง๋ฅผ ์ด๋ป๊ฒ ๊ตฌํํ๋์ง ์์๋ณด์! ์๋๋ก์ด๋์์๋ ์ฌ๋ฌ ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ๋คํฌ ํ ๋ง๋ฅผ ๊ตฌํํ ์ ์๋๋ฐ, ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ด๊ณ ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ๋ถํฐ ์ฐจ๊ทผ์ฐจ๊ทผ ์ดํด๋ณผ๊ฒ. ๐
๐ ๋คํฌ ํ ๋ง ๊ตฌํ ๋ฐฉ์์ ์ข ๋ฅ
์๋๋ก์ด๋์์ ๋คํฌ ํ ๋ง๋ฅผ ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ํฌ๊ฒ ์ธ ๊ฐ์ง๋ก ๋๋ ์ ์์ด:
๊ฐ๊ฐ์ ๋ฐฉ์์ ์ฅ๋จ์ ์ด ์์ด. Force Dark๋ ๊ฐ์ฅ ๊ฐ๋จํ์ง๋ง ์ธ๋ฐํ ์ ์ด๊ฐ ์ด๋ ต๊ณ , DayNight ํ ๋ง๋ ๊ตฌ๊ธ์ด ๊ถ์ฅํ๋ ํ์ค ๋ฐฉ์์ด๋ฉฐ, ์ปค์คํ ๊ตฌํ์ ์์ ํ ์ ์ด๊ฐ ๊ฐ๋ฅํ์ง๋ง ์์ ๋์ด ๋ง์. ๋๋ถ๋ถ์ ๊ฒฝ์ฐ DayNight ํ ๋ง๋ฅผ ์ฌ์ฉํ๋ ๊ฒ ๊ฐ์ฅ ์ข์ ์ ํ์ด์ผ! โจ
๐จ DayNight ํ ๋ง ๊ธฐ๋ณธ ์ค์
DayNight ํ ๋ง๋ ์๋๋ก์ด๋๊ฐ ์ ๊ณตํ๋ ๊ฐ์ฅ ํ์ค์ ์ธ ๋คํฌ ํ ๋ง ๊ตฌํ ๋ฐฉ์์ด์ผ. res/values/themes.xml ํ์ผ์์ ์ค์ ํ ์ ์์ด:
<resources>
<!-- Light ํ
๋ง (values/themes.xml) -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
</style>
</resources>
๊ทธ๋ฆฌ๊ณ res/values-night/themes.xml ํ์ผ์ ๋ง๋ค์ด์ ๋คํฌ ํ ๋ง์ฉ ์์์ ์ ์ํด:
<resources>
<!-- Dark ํ
๋ง (values-night/themes.xml) -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
</style>
</resources>
์ด๋ ๊ฒ ์ค์ ํ๋ฉด ์์คํ ์ ๋คํฌ ๋ชจ๋ ์ค์ ์ ๋ฐ๋ผ ์๋์ผ๋ก ํ ๋ง๊ฐ ์ ํ๋ผ! ์ ๋ง ๊ฐ๋จํ์ง? ๐
๐ก Pro Tip: Theme.MaterialComponents.DayNight๋ฅผ ๋ถ๋ชจ ํ ๋ง๋ก ์ฌ์ฉํ๋ฉด Material Design์ ๋คํฌ ํ ๋ง ๊ฐ์ด๋๋ผ์ธ์ ์๋์ผ๋ก ๋ฐ๋ฅด๊ฒ ๋ผ. ์ด๊ฑด ๊ตฌ๊ธ์ด ์๋ ๊ฐ ์ฐ๊ตฌํ ๊ฒฐ๊ณผ๋ฌผ์ด๋๊น ๋ฏฟ๊ณ ์ฌ์ฉํด๋ ์ข์!
๐จ ์์ ๋ฆฌ์์ค ๊ด๋ฆฌ ์ ๋ต
๋คํฌ ํ ๋ง๋ฅผ ์ ๋๋ก ๊ตฌํํ๋ ค๋ฉด ์์ ๋ฆฌ์์ค๋ฅผ ์ฒด๊ณ์ ์ผ๋ก ๊ด๋ฆฌํ๋ ๊ฒ ์ ๋ง ์ค์ํด! ํ๋์ฝ๋ฉ๋ ์์ ๊ฐ์ ์ฌ์ฉํ๋ฉด ๋์ค์ ์ ์ง๋ณด์๊ฐ ์ ๋ชฝ์ด ๋๊ฑฐ๋ . ๐ฑ ํจ์จ์ ์ธ ์์ ๊ด๋ฆฌ ๋ฐฉ๋ฒ์ ์์๋ณด์!
๐ ์์ ๋ฆฌ์์ค ํ์ผ ๊ตฌ์กฐ
์์ ๋ฆฌ์์ค๋ ๋ค์๊ณผ ๊ฐ์ ๊ตฌ์กฐ๋ก ๊ด๋ฆฌํ๋ ๊ฒ ์ข์:
res/
โโโ values/
โ โโโ colors.xml (๊ธฐ๋ณธ ์์ ํ๋ ํธ)
โ โโโ themes.xml (๋ผ์ดํธ ํ
๋ง)
โโโ values-night/
โโโ colors.xml (๋คํฌ ๋ชจ๋์ฉ ์์)
โโโ themes.xml (๋คํฌ ํ
๋ง)
values/colors.xml์๋ ๊ธฐ๋ณธ ์์ ํ๋ ํธ๋ฅผ ์ ์ํด:
<resources>
<!-- ๋ธ๋๋ ์์ -->
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<!-- ์ค๋ฆฝ ์์ -->
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<!-- ์๋งจํฑ ์์ (๋ผ์ดํธ ๋ชจ๋) -->
<color name="background">#FFFFFFFF</color>
<color name="surface">#FFFFFFFF</color>
<color name="text_primary">#DE000000</color>
<color name="text_secondary">#99000000</color>
</resources>
values-night/colors.xml์๋ ๋คํฌ ๋ชจ๋์ฉ ์์์ ์ ์ํด:
<resources>
<!-- ์๋งจํฑ ์์ (๋คํฌ ๋ชจ๋) -->
<color name="background">#FF121212</color>
<color name="surface">#FF1E1E1E</color>
<color name="text_primary">#DEFFFFFF</color>
<color name="text_secondary">#99FFFFFF</color>
</resources>
๐ฏ ์๋งจํฑ ๋ค์ด๋ฐ์ ์ค์์ฑ
์์ ์ด๋ฆ์ ์ง์ ๋๋ "blue", "red" ๊ฐ์ ์์ ์์ฒด์ ์ด๋ฆ๋ณด๋ค๋ "primary", "background", "text_primary" ๊ฐ์ ์ฉ๋ ๊ธฐ๋ฐ ์ด๋ฆ์ ์ฌ์ฉํ๋ ๊ฒ ํจ์ฌ ์ข์! ๐จ
โ ๋์ ์:
<TextView
android:textColor="@color/blue_500" />
โ ์ข์ ์:
<TextView
android:textColor="?attr/colorPrimary" />
ํ ๋ง ์์ฑ(attr)์ ์ฌ์ฉํ๋ฉด ์์คํ ์ด ํ์ฌ ํ ๋ง์ ๋ง๋ ์์์ ์๋์ผ๋ก ์ ํํด์ค. ์ด๊ฒ ๋ฐ๋ก ๋คํฌ ํ ๋ง ๊ตฌํ์ ํต์ฌ์ด์ผ! โจ
โ ๏ธ ์ฃผ์์ฌํญ: ํ๋์ฝ๋ฉ๋ ์์ ๊ฐ(์: #FFFFFF)์ XML์ด๋ ์ฝ๋์ ์ง์ ์ฌ์ฉํ์ง ๋ง! ๋์ค์ ๋คํฌ ํ ๋ง๋ฅผ ์ ์ฉํ ๋ ๋ชจ๋ ํ์ผ์ ์ผ์ผ์ด ์์ ํด์ผ ํ๋ ์ง์ฅ์ ๊ฒฝํํ๊ฒ ๋ ๊ฑฐ์ผ. ๐ฑ ํญ์ ๋ฆฌ์์ค๋ ํ ๋ง ์์ฑ์ ์ฌ์ฉํ์!
๐ Material Design ์์ ์์คํ
Material Design 3์์๋ ๋์ฑ ์ฒด๊ณ์ ์ธ ์์ ์์คํ ์ ์ ๊ณตํด. ์ฃผ์ ์์ ์ญํ ์ ๋ค์๊ณผ ๊ฐ์:
| ์์ ์ญํ | ์ค๋ช | ์ฌ์ฉ ์์ |
|---|---|---|
| Primary | ์ฑ์ ์ฃผ์ ๋ธ๋๋ ์์ | ์ฃผ์ ๋ฒํผ, FAB, ํ์ฑ ์ํ |
| Secondary | ๋ณด์กฐ ์์ | ํํฐ ์นฉ, ์งํ ํ์๊ธฐ |
| Tertiary | ๊ฐ์กฐ ์์ | ์ ๋ ฅ ํ๋, ๋งํฌ |
| Surface | ์นด๋, ์ํธ ๋ฑ์ ๋ฐฐ๊ฒฝ | ์นด๋, ๋ค์ด์ผ๋ก๊ทธ, ๋ฉ๋ด |
| Background | ํ๋ฉด์ ๊ธฐ๋ณธ ๋ฐฐ๊ฒฝ | ์คํฌ๋ฆฐ ๋ฐฐ๊ฒฝ |
| Error | ์ค๋ฅ ์ํ ํ์ | ์ค๋ฅ ๋ฉ์์ง, ๊ฒฝ๊ณ |
๊ฐ ์์ ์ญํ ์๋ "On" ๋ณํ๋ ์์ด. ์๋ฅผ ๋ค์ด colorOnPrimary๋ Primary ์์ ์์ ํ์๋๋ ํ ์คํธ๋ ์์ด์ฝ์ ์์์ด์ผ. ์ด๋ ๊ฒ ํ๋ฉด ํญ์ ์ ์ ํ ๋๋น๋ฅผ ์ ์งํ ์ ์์ง! ๐
๐ป ์ฝ๋์์ ๋คํฌ ํ ๋ง ์ ์ดํ๊ธฐ
๋๋ก๋ ์ฌ์ฉ์๊ฐ ์ง์ ์ฑ ๋ด์์ ํ ๋ง๋ฅผ ์ ํํ ์ ์๊ฒ ํด์ฃผ๊ณ ์ถ์ ๋๊ฐ ์์ด. ์์คํ ์ค์ ๊ณผ ๋ณ๊ฐ๋ก ์ฑ ์์ฒด์์ ํ ๋ง๋ฅผ ์ ์ดํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์! ๐ฎ
๐ ํ ๋ง ์ ํ ๊ตฌํํ๊ธฐ
AppCompatDelegate ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฐํ์์ ํ ๋ง๋ฅผ ๋ณ๊ฒฝํ ์ ์์ด:
import androidx.appcompat.app.AppCompatDelegate
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// ์ ์ฅ๋ ํ
๋ง ์ค์ ๋ถ๋ฌ์ค๊ธฐ
val sharedPreferences = getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
val themeMode = sharedPreferences.getInt("theme_mode", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
AppCompatDelegate.setDefaultNightMode(themeMode)
// ํ
๋ง ์ ํ ๋ฒํผ ์ค์
setupThemeToggle()
}
private fun setupThemeToggle() {
val themeToggleButton = findViewById<Button>(R.id.theme_toggle_button)
themeToggleButton.setOnClickListener {
showThemeDialog()
}
}
private fun showThemeDialog() {
val options = arrayOf("๋ผ์ดํธ ๋ชจ๋", "๋คํฌ ๋ชจ๋", "์์คํ
์ค์ ๋ฐ๋ฅด๊ธฐ")
val currentMode = AppCompatDelegate.getDefaultNightMode()
val checkedItem = when (currentMode) {
AppCompatDelegate.MODE_NIGHT_NO -> 0
AppCompatDelegate.MODE_NIGHT_YES -> 1
else -> 2
}
AlertDialog.Builder(this)
.setTitle("ํ
๋ง ์ ํ")
.setSingleChoiceItems(options, checkedItem) { dialog, which ->
val mode = when (which) {
0 -> AppCompatDelegate.MODE_NIGHT_NO
1 -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
// ํ
๋ง ๋ณ๊ฒฝ ์ ์ฉ
AppCompatDelegate.setDefaultNightMode(mode)
// ์ค์ ์ ์ฅ
saveThemePreference(mode)
dialog.dismiss()
}
.show()
}
private fun saveThemePreference(mode: Int) {
val sharedPreferences = getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
sharedPreferences.edit().putInt("theme_mode", mode).apply()
}
}
์ด ์ฝ๋๋ ์ฌ์ฉ์๊ฐ ์ ํํ ํ ๋ง ์ค์ ์ SharedPreferences์ ์ ์ฅํ๊ณ , ์ฑ์ด ์์๋ ๋ ๋ถ๋ฌ์์ ์ ์ฉํด. ์ ๋ง ๊ฐ๋จํ์ง? ๐
๐๏ธ ํ ๋ง ๋ชจ๋ ์ต์
AppCompatDelegate์์ ์ ๊ณตํ๋ ์ฃผ์ ํ ๋ง ๋ชจ๋๋ ๋ค์๊ณผ ๊ฐ์:
MODE_NIGHT_NO ๐
ํญ์ ๋ผ์ดํธ ๋ชจ๋๋ฅผ ์ฌ์ฉํด. ์์คํ
์ค์ ๊ณผ ๋ฌด๊ดํ๊ฒ ๋ฐ์ ํ
๋ง๊ฐ ์ ์ฉ๋ผ.
MODE_NIGHT_YES ๐
ํญ์ ๋คํฌ ๋ชจ๋๋ฅผ ์ฌ์ฉํด. ์์คํ
์ค์ ๊ณผ ๋ฌด๊ดํ๊ฒ ์ด๋์ด ํ
๋ง๊ฐ ์ ์ฉ๋ผ.
MODE_NIGHT_FOLLOW_SYSTEM โ๏ธ
์์คํ
์ ๋คํฌ ๋ชจ๋ ์ค์ ์ ๋ฐ๋ผ๊ฐ. Android 10 ์ด์์์ ๊ถ์ฅ๋๋ ๋ฐฉ์์ด์ผ.
MODE_NIGHT_AUTO_BATTERY ๐
๋ฐฐํฐ๋ฆฌ ์ ์ฝ ๋ชจ๋๊ฐ ํ์ฑํ๋๋ฉด ์๋์ผ๋ก ๋คํฌ ๋ชจ๋๋ก ์ ํ๋ผ.
MODE_NIGHT_AUTO_TIME ๐
์๊ฐ์ ๋ฐ๋ผ ์๋์ผ๋ก ์ ํ๋ผ. ์ผ๋ชฐ ํ์๋ ๋คํฌ ๋ชจ๋, ์ผ์ถ ํ์๋ ๋ผ์ดํธ ๋ชจ๋๊ฐ ์ ์ฉ๋ผ.
๋๋ถ๋ถ์ ๊ฒฝ์ฐ MODE_NIGHT_FOLLOW_SYSTEM์ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์ฌ์ฉํ๊ณ , ์ฌ์ฉ์๊ฐ ์ํ๋ฉด ์๋์ผ๋ก ๋ณ๊ฒฝํ ์ ์๊ฒ ํ๋ ๊ฒ ๊ฐ์ฅ ์ข์ UX์ผ! ๐
๐ก Pro Tip: ํ ๋ง๋ฅผ ๋ณ๊ฒฝํ ๋๋ recreate()๋ฅผ ํธ์ถํ ํ์๊ฐ ์์ด! AppCompatDelegate.setDefaultNightMode()๊ฐ ์๋์ผ๋ก ์กํฐ๋นํฐ๋ฅผ ์ฌ์์ฑํด์ค. ํ์ง๋ง ๋ถ๋๋ฌ์ด ์ ํ ์ ๋๋ฉ์ด์ ์ ์ํ๋ค๋ฉด ์ปค์คํ ์ ํ ํจ๊ณผ๋ฅผ ์ถ๊ฐํ ์ ์์ด.
๐ ํ์ฌ ํ ๋ง ๋ชจ๋ ๊ฐ์งํ๊ธฐ
๋๋ก๋ ํ์ฌ ๋คํฌ ๋ชจ๋๊ฐ ํ์ฑํ๋์ด ์๋์ง ํ์ธํด์ผ ํ ๋๊ฐ ์์ด. ์๋ฅผ ๋ค์ด ํน์ ์ด๋ฏธ์ง๋ ์์ด์ฝ์ ํ ๋ง์ ๋ง๊ฒ ๋ณ๊ฒฝํ๊ณ ์ถ์ ๋ ๋ง์ด์ผ:
fun isDarkModeEnabled(context: Context): Boolean {
val nightModeFlags = context.resources.configuration.uiMode and
Configuration.UI_MODE_NIGHT_MASK
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES
}
// ์ฌ์ฉ ์์
if (isDarkModeEnabled(this)) {
// ๋คํฌ ๋ชจ๋์ผ ๋์ ์ฒ๋ฆฌ
imageView.setImageResource(R.drawable.logo_dark)
} else {
// ๋ผ์ดํธ ๋ชจ๋์ผ ๋์ ์ฒ๋ฆฌ
imageView.setImageResource(R.drawable.logo_light)
}
ํ์ง๋ง ๋๋ถ๋ถ์ ๊ฒฝ์ฐ ์ด๋ฐ ์๋ ์ฒดํฌ๋ณด๋ค๋ ๋ฆฌ์์ค ํ์ ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ ๋ ๊น๋ํด! ๐จ
๐ผ๏ธ ์ด๋ฏธ์ง์ ์์ด์ฝ ๋์ํ๊ธฐ
๋คํฌ ํ ๋ง๋ฅผ ๊ตฌํํ ๋ ๊ฐ์ฅ ๊น๋ค๋ก์ด ๋ถ๋ถ ์ค ํ๋๊ฐ ๋ฐ๋ก ์ด๋ฏธ์ง์ ์์ด์ฝ ์ฒ๋ฆฌ์ผ. ๋ผ์ดํธ ๋ชจ๋์์๋ ์ ๋ณด์ด๋ ์ด๋ฏธ์ง๊ฐ ๋คํฌ ๋ชจ๋์์๋ ์ ํ ์ ๋ณด์ผ ์๋ ์๊ฑฐ๋ ! ๐ ํจ๊ณผ์ ์ธ ๋์ ๋ฐฉ๋ฒ์ ์์๋ณด์.
๐ ๋ฆฌ์์ค ํ์ ์ ํ์ฉํ๊ธฐ
๊ฐ์ฅ ๊ฐ๋จํ๊ณ ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ์ night ๋ฆฌ์์ค ํ์ ์๋ฅผ ์ฌ์ฉํ๋ ๊ฑฐ์ผ:
res/
โโโ drawable/
โ โโโ logo.png (๋ผ์ดํธ ๋ชจ๋์ฉ)
โ โโโ icon_star.xml
โโโ drawable-night/
โโโ logo.png (๋คํฌ ๋ชจ๋์ฉ)
โโโ icon_star.xml
์ด๋ ๊ฒ ํ๋ฉด ์์คํ ์ด ์๋์ผ๋ก ํ์ฌ ํ ๋ง์ ๋ง๋ ๋ฆฌ์์ค๋ฅผ ์ ํํด์ค. ์ฝ๋์์๋ ๊ทธ๋ฅ ํ์์ฒ๋ผ ์ฌ์ฉํ๋ฉด ๋ผ:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo" />
์์คํ ์ด ์์์ drawable ๋๋ drawable-night ํด๋์์ ์ ์ ํ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์! ์ ๋ง ํธ๋ฆฌํ์ง? ๐
๐จ ๋ฒกํฐ ๋๋ก์ด๋ธ๊ณผ ํดํธ ํ์ฉ
๋ฒกํฐ ๋๋ก์ด๋ธ(Vector Drawable)์ ์ฌ์ฉํ๋ฉด ๋์ฑ ์ ์ฐํ๊ฒ ๋์ํ ์ ์์ด. ํดํธ(tint)๋ฅผ ์ฌ์ฉํ๋ฉด ํ๋์ ์์ด์ฝ์ผ๋ก ์ฌ๋ฌ ์์์ ํํํ ์ ์๊ฑฐ๋ :
<!-- res/drawable/icon_heart.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>
์ฌ๊ธฐ์ android:fillColor์ ?attr/colorPrimary๋ฅผ ์ฌ์ฉํ์ด. ์ด๋ ๊ฒ ํ๋ฉด ํ ๋ง๊ฐ ๋ฐ๋ ๋ ์๋์ผ๋ก ์์์ด ๋ณ๊ฒฝ๋ผ! ๐
ImageView์์๋ ํดํธ๋ฅผ ์ ์ฉํ ์ ์์ด:
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/icon_heart"
android:tint="?attr/colorPrimary" />
๐ผ๏ธ ๋นํธ๋งต ์ด๋ฏธ์ง ์ฒ๋ฆฌ ์ ๋ต
์ฌ์ง์ด๋ ๋ณต์กํ ๊ทธ๋ํฝ ๊ฐ์ ๋นํธ๋งต ์ด๋ฏธ์ง๋ ์ด๋ป๊ฒ ์ฒ๋ฆฌํด์ผ ํ ๊น? ๋ช ๊ฐ์ง ์ ๋ต์ด ์์ด:
1. ํฌ๋ช
๋ฐฐ๊ฒฝ ์ฌ์ฉ ๐ญ
๊ฐ๋ฅํ๋ฉด ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ์ ํฌ๋ช
ํ๊ฒ ๋ง๋ค์ด. ๊ทธ๋ฌ๋ฉด ์ด๋ค ๋ฐฐ๊ฒฝ์ ์์์๋ ์์ฐ์ค๋ฝ๊ฒ ๋ณด์ฌ.
2. ํ
๋๋ฆฌ๋ ๊ทธ๋ฆผ์ ์ถ๊ฐ โจ
์ด๋ฏธ์ง ์ฃผ๋ณ์ ๋ฏธ๋ฌํ ํ
๋๋ฆฌ๋ ๊ทธ๋ฆผ์๋ฅผ ์ถ๊ฐํ๋ฉด ๋คํฌ ๋ฐฐ๊ฒฝ์์๋ ์ ๊ตฌ๋ถ๋ผ:
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/photo"
android:elevation="4dp"
android:outlineProvider="bounds" />
3. ์ค๋ฒ๋ ์ด ์ฌ์ฉ ๐จ
๋คํฌ ๋ชจ๋์์ ์ด๋ฏธ์ง๊ฐ ๋๋ฌด ๋ฐ๋ค๋ฉด, ๋ฐํฌ๋ช
์ค๋ฒ๋ ์ด๋ฅผ ์ถ๊ฐํด์ ๋ฐ๊ธฐ๋ฅผ ์กฐ์ ํ ์ ์์ด:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/photo"
android:scaleType="centerCrop" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#40000000" />
</FrameLayout>
โ ๏ธ ์ฃผ์์ฌํญ: ๋ก๊ณ ๋ ๋ธ๋๋ ์ด๋ฏธ์ง๋ ์ ์คํ๊ฒ ์ฒ๋ฆฌํด์ผ ํด! ๋ธ๋๋ ๊ฐ์ด๋๋ผ์ธ์ ํ์ธํ๊ณ , ํ์ํ๋ค๋ฉด ๋์์ด๋์ ํ์ํด์ ๋คํฌ ๋ชจ๋์ฉ ๋ฒ์ ์ ๋ฐ๋ก ๋ง๋๋ ๊ฒ ์ข์. ์๋ ๋ณํ์ด๋ ํดํธ๋ฅผ ์ ์ฉํ๋ฉด ๋ธ๋๋ ์ ์ฒด์ฑ์ด ์์๋ ์ ์๊ฑฐ๋ . ๐จ
๐ก Pro Tip: Material Design ์์ด์ฝ์ ์ฌ์ฉํ๋ค๋ฉด ๊ตฌ๊ธ์ด ์ ๊ณตํ๋ ๊ณต์ ์์ด์ฝ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํด๋ด! ์ด๋ฏธ ๋คํฌ ํ ๋ง์ ์ต์ ํ๋์ด ์๊ณ , ๋ฒกํฐ ํ์์ด๋ผ ํฌ๊ธฐ ์กฐ์ ๋ ์์ ๋ก์. ์ฌ๋ฅ๋ท ๊ฐ์ ํ๋ซํผ์์ ๋์์ด๋๋ฅผ ์ฐพ์ ์ปค์คํ ์์ด์ฝ ์ธํธ๋ฅผ ์๋ขฐํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด์ผ! ๐จ
๐ ๋ ์ด์์๊ณผ UI ์ปดํฌ๋ํธ ๋์
๋คํฌ ํ ๋ง์์๋ ๋จ์ํ ์์๋ง ๋ฐ๊พธ๋ ๊ฒ ์๋๋ผ, ์ ์ฒด์ ์ธ ์๊ฐ์ ๊ณ์ธต ๊ตฌ์กฐ๋ ๋ค์ ์๊ฐํด์ผ ํด. ๋ผ์ดํธ ๋ชจ๋์์ ์ ์๋ํ๋ ๊ทธ๋ฆผ์๋ ๊ตฌ๋ถ์ ์ด ๋คํฌ ๋ชจ๋์์๋ ํจ๊ณผ๊ฐ ์์ ์ ์๊ฑฐ๋ ! ๐จ
๐๏ธ Elevation๊ณผ Surface
Material Design์์๋ elevation(๋์ด)์ ์ฌ์ฉํด์ UI ์์๋ค์ ๊ณ์ธต์ ํํํด. ๋คํฌ ํ ๋ง์์๋ elevation์ด ๋์ฑ ์ค์ํ ์ญํ ์ ํด:
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="4dp"
app:cardCornerRadius="8dp"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="์นด๋ ์ ๋ชฉ"
android:textAppearance="?attr/textAppearanceHeadline6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="์นด๋ ๋ด์ฉ"
android:textAppearance="?attr/textAppearanceBody2"
android:layout_marginTop="8dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
๋คํฌ ํ ๋ง์์๋ elevation์ด ๋์์๋ก surface๊ฐ ๋ ๋ฐ์์ ธ. ์ด๊ฒ Material Design์ ํต์ฌ ์์น์ด์ผ! ๐
Elevation๋ณ ๋ฐ๊ธฐ ๋ณํ:
โข 0dp: #121212 (๊ธฐ๋ณธ ๋ฐฐ๊ฒฝ)
โข 1dp: #1E1E1E
โข 2dp: #232323
โข 4dp: #272727
โข 6dp: #2C2C2C
โข 8dp: #2E2E2E
โข 12dp: #333333
โข 16dp: #353535
โข 24dp: #383838
์ด ์์คํ ์ ์ฌ์ฉํ๋ฉด ๊ทธ๋ฆผ์ ์์ด๋ ๋ช ํํ ๊ณ์ธต ๊ตฌ์กฐ๋ฅผ ๋ง๋ค ์ ์์ด! ๐
๐จ ๊ตฌ๋ถ์ ๊ณผ ๊ฒฝ๊ณ์ ์ฒ๋ฆฌ
๋ผ์ดํธ ๋ชจ๋์์๋ ๋ฐ์ ํ์ ๊ตฌ๋ถ์ ์ด ์ ๋ณด์ด์ง๋ง, ๋คํฌ ๋ชจ๋์์๋ ๊ฑฐ์ ์ ๋ณด์ผ ์ ์์ด. ๋คํฌ ํ ๋ง์ฉ ๊ตฌ๋ถ์ ์์์ ๋ฐ๋ก ์ ์ํด์ผ ํด:
<!-- values/colors.xml -->
<color name="divider">#1F000000</color>
<!-- values-night/colors.xml -->
<color name="divider">#1FFFFFFF</color>
๊ทธ๋ฆฌ๊ณ ๋ ์ด์์์์ ์ฌ์ฉ:
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider" />
๋๋ Material Divider๋ฅผ ์ฌ์ฉํ ์๋ ์์ด:
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content" />
MaterialDivider๋ ์๋์ผ๋ก ํ ๋ง์ ๋ง๋ ์์์ ์ ์ฉํด์ค! ํธ๋ฆฌํ์ง? ๐
๐ ํ ์คํธ ๊ฐ๋ ์ฑ ํ๋ณด
๋คํฌ ํ ๋ง์์ ํ ์คํธ ๊ฐ๋ ์ฑ์ ์ ๋ง ์ค์ํด! Material Design์์๋ ํ ์คํธ ํฌ๋ช ๋๋ฅผ ์ฌ์ฉํด์ ๊ณ์ธต์ ํํํด:
| ํ ์คํธ ์ ํ | ๋ผ์ดํธ ๋ชจ๋ | ๋คํฌ ๋ชจ๋ |
|---|---|---|
| High emphasis | 87% ๊ฒ์ | 87% ํฐ์ |
| Medium emphasis | 60% ๊ฒ์ | 60% ํฐ์ |
| Disabled | 38% ๊ฒ์ | 38% ํฐ์ |
TextAppearance๋ฅผ ์ฌ์ฉํ๋ฉด ์ด๋ฐ ์คํ์ผ์ ์ฝ๊ฒ ์ ์ฉํ ์ ์์ด:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="์ ๋ชฉ"
android:textAppearance="?attr/textAppearanceHeadline6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="๋ณธ๋ฌธ"
android:textAppearance="?attr/textAppearanceBody1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="์บก์
"
android:textAppearance="?attr/textAppearanceCaption" />
๐ก Pro Tip: ๋คํฌ ํ ๋ง์์๋ ์์ํ ๊ฒ์ (#000000)์ด๋ ์์ํ ํฐ์(#FFFFFF)์ ๋ฐฐ๊ฒฝ์ผ๋ก ์ฌ์ฉํ์ง ๋ง! Material Design์์๋ ๋คํฌ ํ ๋ง์ ๊ธฐ๋ณธ ๋ฐฐ๊ฒฝ์ผ๋ก #121212๋ฅผ ๊ถ์ฅํด. ์ด ์์์ OLED ๋์คํ๋ ์ด์์ ๋ฒ์ธ(burn-in)์ ๋ฐฉ์งํ๋ฉด์๋ ์ถฉ๋ถํ ์ด๋์ ๋ณด์ฌ. ๐
๐ญ ์ปค์คํ ๋ทฐ์ ์บ๋ฒ์ค ๋์
์ปค์คํ ๋ทฐ๋ฅผ ๋ง๋ค ๋๋ ๋คํฌ ํ ๋ง ๋์์ด ์ข ๋ ๊น๋ค๋ก์. ์ง์ Canvas์ ๊ทธ๋ฆฌ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์์ ์์์ ํ๋์ฝ๋ฉํ๊ธฐ ์ฝ๊ฑฐ๋ . ํ์ง๋ง ๊ฑฑ์ ๋ง! ์ ๋๋ก ๋ ๋ฐฉ๋ฒ์ด ์์ด. ๐จ
๐๏ธ Paint ๊ฐ์ฒด์ ํ ๋ง ์์ ์ ์ฉํ๊ธฐ
์ปค์คํ ๋ทฐ์์ Paint๋ฅผ ์ฌ์ฉํ ๋๋ ํ ๋ง ์์ฑ์์ ์์์ ๊ฐ์ ธ์์ผ ํด:
class CustomChartView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
private var primaryColor: Int = 0
private var textColor: Int = 0
private var backgroundColor: Int = 0
init {
// ํ
๋ง์์ ์์ ๊ฐ์ ธ์ค๊ธฐ
updateColors()
}
private fun updateColors() {
val typedValue = TypedValue()
val theme = context.theme
// Primary ์์
theme.resolveAttribute(
com.google.android.material.R.attr.colorPrimary,
typedValue,
true
)
primaryColor = typedValue.data
// ํ
์คํธ ์์
theme.resolveAttribute(
android.R.attr.textColorPrimary,
typedValue,
true
)
textColor = typedValue.data
// ๋ฐฐ๊ฒฝ ์์
theme.resolveAttribute(
android.R.attr.colorBackground,
typedValue,
true
)
backgroundColor = typedValue.data
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
// ๋ฐฐ๊ฒฝ ๊ทธ๋ฆฌ๊ธฐ
canvas.drawColor(backgroundColor)
// ์ฐจํธ ๊ทธ๋ฆฌ๊ธฐ
paint.color = primaryColor
paint.strokeWidth = 4f
paint.style = Paint.Style.STROKE
// ์ฌ๊ธฐ์ ์ฐจํธ ๊ทธ๋ฆฌ๊ธฐ ๋ก์ง...
// ํ
์คํธ ๊ทธ๋ฆฌ๊ธฐ
paint.color = textColor
paint.textSize = 40f
paint.style = Paint.Style.FILL
canvas.drawText("Chart Title", 50f, 100f, paint)
}
// ํ
๋ง๊ฐ ๋ณ๊ฒฝ๋์์ ๋ ํธ์ถ
override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)
updateColors()
invalidate() // ๋ค์ ๊ทธ๋ฆฌ๊ธฐ
}
}
์ด๋ ๊ฒ ํ๋ฉด ํ ๋ง๊ฐ ๋ณ๊ฒฝ๋ ๋๋ง๋ค ์๋์ผ๋ก ์ ์ ํ ์์์ด ์ ์ฉ๋ผ! ๐
๐จ ContextCompat ํ์ฉํ๊ธฐ
๋ ๊ฐ๋จํ ๋ฐฉ๋ฒ๋ ์์ด. ContextCompat์ ์ฌ์ฉํ๋ฉด ๋ฆฌ์์ค์์ ์ง์ ์์์ ๊ฐ์ ธ์ฌ ์ ์์ด:
import androidx.core.content.ContextCompat
class SimpleCustomView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : View(context, attrs) {
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = ContextCompat.getColor(context, R.color.primary)
strokeWidth = 4f
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
// ํ์ฌ ํ
๋ง์ ๋ง๋ ์์์ผ๋ก ๊ทธ๋ฆฌ๊ธฐ
paint.color = ContextCompat.getColor(context, R.color.primary)
canvas.drawCircle(width / 2f, height / 2f, 100f, paint)
}
}
ContextCompat.getColor()๋ ์๋์ผ๋ก ํ์ฌ ํ ๋ง์ ๋ง๋ ์์์ ๋ฐํํด์ค! ๐
โ ๏ธ ์ฃผ์์ฌํญ: ์ปค์คํ ๋ทฐ์์ Color.parseColor("#FFFFFF") ๊ฐ์ ๋ฐฉ์์ผ๋ก ์์์ ํ๋์ฝ๋ฉํ์ง ๋ง! ํ ๋ง๊ฐ ๋ณ๊ฒฝ๋์ด๋ ์์์ด ๋ฐ๋์ง ์์์ ๋คํฌ ๋ชจ๋์์ ๋ฌธ์ ๊ฐ ์๊ฒจ. ํญ์ ๋ฆฌ์์ค๋ ํ ๋ง ์์ฑ์์ ์์์ ๊ฐ์ ธ์ค์! ๐จ
๐ง ์๋ํํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋์
์ค์ ํ๋ก์ ํธ์์๋ ๋ค์ํ ์๋ํํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๊ฒ ๋ผ. ์ด๋ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ด ๋คํฌ ํ ๋ง๋ฅผ ์ ๋๋ก ์ง์ํ์ง ์์ผ๋ฉด ์ฑ ์ ์ฒด์ ์ผ๊ด์ฑ์ด ๊นจ์ง ์ ์์ด. ์ฃผ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ ๋คํฌ ํ ๋ง ๋์ ๋ฐฉ๋ฒ์ ์์๋ณด์! ๐
๐ผ๏ธ Glide ์ด๋ฏธ์ง ๋ก๋ฉ
Glide๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋คํฌ ํ ๋ง๋ฅผ ์ ์ง์ํ์ง๋ง, ํ๋ ์ด์คํ๋๋ ์๋ฌ ์ด๋ฏธ์ง๋ ์ง์ ์ค์ ํด์ค์ผ ํด:
// ํ
๋ง์ ๋ง๋ ํ๋ ์ด์คํ๋ ์ ํ
val placeholderRes = if (isDarkModeEnabled(context)) {
R.drawable.placeholder_dark
} else {
R.drawable.placeholder_light
}
Glide.with(context)
.load(imageUrl)
.placeholder(placeholderRes)
.error(placeholderRes)
.into(imageView)
๋๋ ๋ฆฌ์์ค ํ์ ์๋ฅผ ํ์ฉํด์ ๋ ๊น๋ํ๊ฒ ์ฒ๋ฆฌํ ์ ์์ด:
Glide.with(context)
.load(imageUrl)
.placeholder(R.drawable.placeholder) // drawable-night์๋ ๊ฐ์ ์ด๋ฆ์ผ๋ก ์ค๋น
.error(R.drawable.error_image)
.into(imageView)
๐ MPAndroidChart
์ฐจํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ MPAndroidChart๋ ๋คํฌ ํ ๋ง๋ฅผ ์๋์ผ๋ก ์ค์ ํด์ค์ผ ํด:
fun setupChart(chart: LineChart) {
val isDarkMode = isDarkModeEnabled(chart.context)
// ๋ฐฐ๊ฒฝ ์์
chart.setBackgroundColor(
if (isDarkMode) Color.parseColor("#121212")
else Color.WHITE
)
// ํ
์คํธ ์์
val textColor = if (isDarkMode) Color.WHITE else Color.BLACK
chart.legend.textColor = textColor
chart.xAxis.textColor = textColor
chart.axisLeft.textColor = textColor
chart.axisRight.textColor = textColor
// ๊ทธ๋ฆฌ๋ ๋ผ์ธ ์์
val gridColor = if (isDarkMode)
Color.parseColor("#333333")
else
Color.parseColor("#E0E0E0")
chart.xAxis.gridColor = gridColor
chart.axisLeft.gridColor = gridColor
chart.axisRight.gridColor = gridColor
// ๋ฐ์ดํฐ ์์๋ ํ
๋ง์ ๋ง๊ฒ ์กฐ์
val dataSet = LineDataSet(entries, "Label")
dataSet.color = ContextCompat.getColor(
chart.context,
R.color.primary
)
dataSet.setCircleColor(
ContextCompat.getColor(
chart.context,
R.color.primary
)
)
}
๐ WebView ๋คํฌ ๋ชจ๋
WebView๋ Android 10๋ถํฐ ๋คํฌ ๋ชจ๋๋ฅผ ์ง์ํด. ํ์ง๋ง ๋ช ์์ ์ผ๋ก ํ์ฑํํด์ค์ผ ํด:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val nightModeFlags = resources.configuration.uiMode and
Configuration.UI_MODE_NIGHT_MASK
if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
WebSettingsCompat.setForceDark(
webView.settings,
WebSettingsCompat.FORCE_DARK_ON
)
}
// ๋คํฌ ๋ชจ๋ ์๊ณ ๋ฆฌ์ฆ ์ ํ (์ ํ์ฌํญ)
if (WebViewFeature.isFeatureSupported(
WebViewFeature.FORCE_DARK_STRATEGY
)) {
WebSettingsCompat.setForceDarkStrategy(
webView.settings,
WebSettingsCompat.DARK_STRATEGY_WEB_THEME_DARKENING_ONLY
)
}
}
}
์น ํ์ด์ง๊ฐ ์์ฒด์ ์ผ๋ก ๋คํฌ ๋ชจ๋๋ฅผ ์ง์ํ๋ค๋ฉด, CSS ๋ฏธ๋์ด ์ฟผ๋ฆฌ๋ฅผ ํตํด ๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ด:
// HTML/CSS์์
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #FFFFFF;
}
}
๐ก Pro Tip: ์๋ํํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ํํ ๋๋ ๋คํฌ ํ ๋ง ์ง์ ์ฌ๋ถ๋ฅผ ๋ฏธ๋ฆฌ ํ์ธํด๋ด! GitHub ์ด์๋ ๋ฌธ์๋ฅผ ์ดํด๋ณด๋ฉด ๋คํฌ ๋ชจ๋ ์ง์ ์ํ๋ฅผ ์ ์ ์์ด. ๋ง์ฝ ์ง์ํ์ง ์๋๋ค๋ฉด, ๋์์ ์ฐพ๊ฑฐ๋ ์ง์ ์ปค์คํฐ๋ง์ด์งํ ์ค๋น๋ฅผ ํด์ผ ํด. ์ฌ๋ฅ๋ท์์ ์๋๋ก์ด๋ ๊ฐ๋ฐ ์ ๋ฌธ๊ฐ๋ฅผ ์ฐพ์ ๋์์ ๋ฐ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด์ผ! ๐
๐ ํํ ๋ฌธ์ ์ ํด๊ฒฐ ๋ฐฉ๋ฒ
๋คํฌ ํ ๋ง๋ฅผ ๊ตฌํํ๋ค ๋ณด๋ฉด ์์์น ๋ชปํ ๋ฌธ์ ๋ค์ ๋ง์ฃผ์น๊ฒ ๋ผ. ์ค์ ๋ก ๋ง์ ๊ฐ๋ฐ์๋ค์ด ๊ฒช๋ ํํ ๋ฌธ์ ๋ค๊ณผ ๊ทธ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ ๋ฆฌํด๋ดค์ด! ๐ง
โ ๋ฌธ์ 1: ํ ๋ง ์ ํ ์ ๊น๋นก์
ํ ๋ง๋ฅผ ์ ํํ ๋ ํ๋ฉด์ด ๊น๋นก์ด๊ฑฐ๋ ์ด์ํ๊ฒ ์ ํ๋๋ ๋ฌธ์ ๊ฐ ์์ด. ์ด๋ ์กํฐ๋นํฐ๊ฐ ์ฌ์์ฑ๋๋ฉด์ ๋ฐ์ํ๋ ํ์์ด์ผ.
ํด๊ฒฐ ๋ฐฉ๋ฒ:
// AndroidManifest.xml์์ ์กํฐ๋นํฐ์ ์ถ๊ฐ
<activity
android:name=".MainActivity"
android:configChanges="uiMode" />
// Activity์์ ์ฒ๋ฆฌ
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// ํ
๋ง ๋ณ๊ฒฝ ๊ฐ์ง
val nightModeFlags = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK
when (nightModeFlags) {
Configuration.UI_MODE_NIGHT_YES -> {
// ๋คํฌ ๋ชจ๋๋ก ์ ํ๋จ
updateUIForDarkMode()
}
Configuration.UI_MODE_NIGHT_NO -> {
// ๋ผ์ดํธ ๋ชจ๋๋ก ์ ํ๋จ
updateUIForLightMode()
}
}
}
ํ์ง๋ง ์ด ๋ฐฉ๋ฒ์ ๊ถ์ฅ๋์ง ์์. ๋์ ๋ถ๋๋ฌ์ด ์ ํ ์ ๋๋ฉ์ด์ ์ ์ถ๊ฐํ๋ ๊ฒ ๋ ๋์:
// ํ
๋ง ์ ํ ์ ์ ํ์ด๋ ์ ๋๋ฉ์ด์
์ถ๊ฐ
window.decorView.animate()
.alpha(0f)
.setDuration(200)
.withEndAction {
AppCompatDelegate.setDefaultNightMode(newMode)
window.decorView.animate()
.alpha(1f)
.setDuration(200)
.start()
}
.start()
โ ๋ฌธ์ 2: ์ํ๋ฐ์ ๋ค๋น๊ฒ์ด์ ๋ฐ ์์
๋คํฌ ํ ๋ง๋ก ์ ํํ๋๋ฐ ์ํ๋ฐ๋ ๋ค๋น๊ฒ์ด์ ๋ฐ๊ฐ ์ฌ์ ํ ๋ฐ์ ์์ผ๋ก ๋จ์์๋ ๊ฒฝ์ฐ๊ฐ ์์ด.
ํด๊ฒฐ ๋ฐฉ๋ฒ:
// themes.xml์์ ์ค์
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight">
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:navigationBarColor">?attr/colorSurface</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<!-- values-night/themes.xml -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight">
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:navigationBarColor">?attr/colorSurface</item>
<item name="android:windowLightStatusBar">false</item>
</style>
๋๋ ์ฝ๋์์ ๋์ ์ผ๋ก ์ค์ :
fun updateSystemBars() {
val isDarkMode = isDarkModeEnabled(this)
window.statusBarColor = ContextCompat.getColor(
this,
if (isDarkMode) R.color.status_bar_dark else R.color.status_bar_light
)
// Android 8.0 ์ด์์์ ๋ค๋น๊ฒ์ด์
๋ฐ ์์ ์ค์
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
window.navigationBarColor = ContextCompat.getColor(
this,
if (isDarkMode) R.color.nav_bar_dark else R.color.nav_bar_light
)
}
// ์ํ๋ฐ ์์ด์ฝ ์์ ์กฐ์
WindowCompat.getInsetsController(window, window.decorView).apply {
isAppearanceLightStatusBars = !isDarkMode
isAppearanceLightNavigationBars = !isDarkMode
}
}
โ ๋ฌธ์ 3: RecyclerView ์์ดํ ๋ฐฐ๊ฒฝ
RecyclerView์ ์์ดํ ๋ค์ด ๋คํฌ ๋ชจ๋์์ ๋ฐฐ๊ฒฝ์์ด ์ ๋๋ก ์ ์ฉ๋์ง ์๋ ๊ฒฝ์ฐ๊ฐ ์์ด.
ํด๊ฒฐ ๋ฐฉ๋ฒ:
<!-- item_layout.xml -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardBackgroundColor="?attr/colorSurface"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnSurface"
android:textAppearance="?attr/textAppearanceHeadline6" />
</LinearLayout>
</androidx.cardview.widget.CardView>
?attr/colorSurface์ ?attr/colorOnSurface๋ฅผ ์ฌ์ฉํ๋ฉด ์๋์ผ๋ก ํ ๋ง์ ๋ง๋ ์์์ด ์ ์ฉ๋ผ! ๐จ
โ ๋ฌธ์ 4: ๋ค์ด์ผ๋ก๊ทธ ๋ฐฐ๊ฒฝ
์ปค์คํ ๋ค์ด์ผ๋ก๊ทธ์ ๋ฐฐ๊ฒฝ์ด ๋คํฌ ๋ชจ๋์์ ํ์๊ฒ ๋์ค๋ ๋ฌธ์ ๊ฐ ์์ฃผ ๋ฐ์ํด.
ํด๊ฒฐ ๋ฐฉ๋ฒ:
// ๋ค์ด์ผ๋ก๊ทธ ๋ ์ด์์
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
android:orientation="vertical"
android:padding="24dp">
<!-- ๋ค์ด์ผ๋ก๊ทธ ๋ด์ฉ -->
</LinearLayout>
// ์ฝ๋์์ ๋ค์ด์ผ๋ก๊ทธ ์์ฑ
val dialog = AlertDialog.Builder(this, R.style.ThemeOverlay_App_MaterialAlertDialog)
.setView(customView)
.create()
// styles.xml
<style name="ThemeOverlay.App.MaterialAlertDialog"
parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorSurface">?attr/colorSurface</item>
<item name="colorOnSurface">?attr/colorOnSurface</item>
</style>
โ ๋ฌธ์ 5: ์คํ๋์ ์คํฌ๋ฆฐ
Android 12๋ถํฐ ๋์ ๋ ์๋ก์ด ์คํ๋์ ์คํฌ๋ฆฐ API๋ ๋คํฌ ํ ๋ง๋ฅผ ๋ณ๋๋ก ์ค์ ํด์ค์ผ ํด.
ํด๊ฒฐ ๋ฐฉ๋ฒ:
<!-- values/themes.xml -->
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splash_background_light</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="postSplashScreenTheme">@style/Theme.MyApp</item>
</style>
<!-- values-night/themes.xml -->
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splash_background_dark</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="postSplashScreenTheme">@style/Theme.MyApp</item>
</style>
<!-- AndroidManifest.xml -->
<activity
android:name=".MainActivity"
android:theme="@style/Theme.App.Starting"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
๐ก Pro Tip: ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ ๋๋ Android Studio์ Layout Inspector๋ฅผ ํ์ฉํด๋ด! ์ค์๊ฐ์ผ๋ก ๋ทฐ ๊ณ์ธต ๊ตฌ์กฐ์ ๊ฐ ์์์ ์์ฑ์ ํ์ธํ ์ ์์ด์ ๋๋ฒ๊น ์ด ํจ์ฌ ์ฌ์์ ธ. Tools โ Layout Inspector ๋ฉ๋ด์์ ์คํํ ์ ์์ด! ๐
โ ๋คํฌ ํ ๋ง ์ฒดํฌ๋ฆฌ์คํธ
๋คํฌ ํ ๋ง ๊ตฌํ์ ์๋ฃํ๋ค๋ฉด, ๋ค์ ์ฒดํฌ๋ฆฌ์คํธ๋ฅผ ํ์ธํด๋ณด์! ๋ชจ๋ ํญ๋ชฉ์ ์ฒดํฌํ๋ค๋ฉด ๋น์ ์ ๋คํฌ ํ ๋ง ๋ง์คํฐ์ผ! ๐
๐จ ๋์์ธ ์ฒดํฌ๋ฆฌ์คํธ
โ Material Design์ ๋คํฌ ํ ๋ง ๊ฐ์ด๋๋ผ์ธ์ ๋ฐ๋๋๊ฐ?
โ ๋ชจ๋ ์์์ด ๋ฆฌ์์ค๋ ํ ๋ง ์์ฑ์ผ๋ก ์ ์๋์ด ์๋๊ฐ?
โ ํ๋์ฝ๋ฉ๋ ์์ ๊ฐ์ด ์๋๊ฐ?
โ ํ ์คํธ์ ๋ฐฐ๊ฒฝ ์ฌ์ด์ ๋๋น๊ฐ ์ถฉ๋ถํ๊ฐ? (์ต์ 4.5:1)
โ Elevation ์์คํ ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ ์ฉ๋์๋๊ฐ?
โ ๋ชจ๋ ์์ด์ฝ๊ณผ ์ด๋ฏธ์ง๊ฐ ๋คํฌ ๋ชจ๋์์ ์ ๋ณด์ด๋๊ฐ?
โ ๊ตฌ๋ถ์ ๊ณผ ๊ฒฝ๊ณ์ ์ด ๋คํฌ ๋ชจ๋์์๋ ๋ช ํํ๊ฐ?
โ ์ํ๋ฐ์ ๋ค๋น๊ฒ์ด์ ๋ฐ ์์์ด ์ ์ ํ๊ฐ?
๐ป ๊ตฌํ ์ฒดํฌ๋ฆฌ์คํธ
โ DayNight ํ ๋ง๋ฅผ ๋ถ๋ชจ ํ ๋ง๋ก ์ฌ์ฉํ๋๊ฐ?
โ values-night ํด๋์ ๋คํฌ ํ ๋ง ๋ฆฌ์์ค๊ฐ ์ ์๋์ด ์๋๊ฐ?
โ ๋ชจ๋ ๋ ์ด์์์์ ํ ๋ง ์์ฑ(?attr/)์ ์ฌ์ฉํ๋๊ฐ?
โ ์ปค์คํ ๋ทฐ๊ฐ ํ ๋ง ๋ณ๊ฒฝ์ ๋์ํ๋๊ฐ?
โ ์๋ํํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ด ๋คํฌ ํ ๋ง๋ฅผ ์ง์ํ๋๊ฐ?
โ WebView์ ๋คํฌ ๋ชจ๋๊ฐ ์ ์ฉ๋์๋๊ฐ?
โ ๋ค์ด์ผ๋ก๊ทธ์ ํ์ ์ ๋ฐฐ๊ฒฝ์์ด ์ ์ ํ๊ฐ?
โ ์คํ๋์ ์คํฌ๋ฆฐ์ด ๋คํฌ ๋ชจ๋๋ฅผ ์ง์ํ๋๊ฐ?
๐งช ํ ์คํธ ์ฒดํฌ๋ฆฌ์คํธ
โ ๋ผ์ดํธ ๋ชจ๋์์ ๋ชจ๋ ํ๋ฉด์ ํ ์คํธํ๋๊ฐ?
โ ๋คํฌ ๋ชจ๋์์ ๋ชจ๋ ํ๋ฉด์ ํ ์คํธํ๋๊ฐ?
โ ํ ๋ง ์ ํ์ด ๋ถ๋๋ฝ๊ฒ ์๋ํ๋๊ฐ?
โ ๋ค์ํ ๊ธฐ๊ธฐ(OLED, LCD)์์ ํ ์คํธํ๋๊ฐ?
โ ๋ค์ํ ์๋๋ก์ด๋ ๋ฒ์ ์์ ํ ์คํธํ๋๊ฐ?
โ ์ ๊ทผ์ฑ ๋๊ตฌ(TalkBack ๋ฑ)์ ํธํ๋๋๊ฐ?
โ ๋ฐฐํฐ๋ฆฌ ์๋ชจ๊ฐ ๊ฐ์ ๋์๋๊ฐ? (OLED ๊ธฐ๊ธฐ)
โ ์ฌ์ฉ์ ํผ๋๋ฐฑ์ ์์งํ๋๊ฐ?
๐ฑ ์ค์ ๊ธฐ๊ธฐ ํ ์คํธ ํ
์๋ฎฌ๋ ์ดํฐ๋ง์ผ๋ก๋ ์ถฉ๋ถํ์ง ์์! ์ค์ ๊ธฐ๊ธฐ์์ ํ ์คํธํ ๋ ๋ค์ ์ฌํญ๋ค์ ํ์ธํด๋ด:
1. OLED ๊ธฐ๊ธฐ์์ ํ
์คํธ ๐ฑ
์ผ์ฑ ๊ฐค๋ญ์ S ์๋ฆฌ์ฆ๋ ๊ตฌ๊ธ ํฝ์
๊ฐ์ OLED ๋์คํ๋ ์ด ๊ธฐ๊ธฐ์์ ํ
์คํธํด๋ด. ์์ํ ๊ฒ์ ์์ด ์ ๋ง ๊บผ์ง๋์ง, ๋ฒ์ธ ํ์์ ์๋์ง ํ์ธํด์ผ ํด.
2. ๋ค์ํ ๋ฐ๊ธฐ์์ ํ
์คํธ โ๏ธ๐
๋ฐ์ ์ค์ธ์ ์ด๋์ด ์ค๋ด์์ ๋ชจ๋ ํ
์คํธํด๋ด. ๊ฐ ํ๊ฒฝ์์ ๊ฐ๋
์ฑ์ด ์ข์์ง ํ์ธํ๋ ๊ฒ ์ค์ํด.
3. ์ฅ์๊ฐ ์ฌ์ฉ ํ
์คํธ โฐ
์ค์ ๋ก 30๋ถ ์ด์ ์ฑ์ ์ฌ์ฉํด๋ณด๋ฉด์ ๋์ ํผ๋ก๋๋ฅผ ์ฒดํฌํด๋ด. ๋คํฌ ๋ชจ๋๊ฐ ์ ๋ง ํธ์ํ์ง ํ์ธํ ์ ์์ด.
4. ๋ฐฐํฐ๋ฆฌ ์๋ชจ ์ธก์ ๐
Android์ Battery Historian์ด๋ Profiler๋ฅผ ์ฌ์ฉํด์ ์ค์ ๋ก ๋ฐฐํฐ๋ฆฌ ์๋ชจ๊ฐ ์ค์ด๋๋์ง ์ธก์ ํด๋ด.
๐ ๊ณ ๊ธ ๊ธฐ๋ฒ๊ณผ ์ต์ ํ
๊ธฐ๋ณธ์ ์ธ ๋คํฌ ํ ๋ง ๊ตฌํ์ ๋ง์คํฐํ๋ค๋ฉด, ์ด์ ํ ๋จ๊ณ ๋ ๋์๊ฐ๋ณด์! ์ฌ์ฉ์ ๊ฒฝํ์ ๊ทน๋ํํ๋ ๊ณ ๊ธ ๊ธฐ๋ฒ๋ค์ ์๊ฐํ ๊ฒ. ๐
๐จ ๋์ ์์ ์์คํ (Material You)
Android 12๋ถํฐ ๋์ ๋ Material You๋ ์ฌ์ฉ์์ ๋ฐฐ๊ฒฝํ๋ฉด์์ ์์์ ์ถ์ถํด์ ์ฑ ํ ๋ง์ ์ ์ฉํด. ์ ๋ง ๋ฉ์ง ๊ธฐ๋ฅ์ด์ง! ๐จ
// build.gradle
dependencies {
implementation 'com.google.android.material:material:1.9.0'
}
// themes.xml
<style name="Theme.MyApp" parent="Theme.Material3.DayNight">
<!-- Material You ๋์ ์์ ํ์ฑํ -->
<item name="android:forceDarkAllowed">true</item>
</style>
// Activity์์
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Android 12 ์ด์์์ ๋์ ์์ ์ ์ฉ
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val dynamicColorOptions = DynamicColorsOptions.Builder()
.setPrecondition { _, _ ->
// ์ฌ์ฉ์ ์ค์ ์ ๋ฐ๋ผ ๋์ ์์ ํ์ฑํ ์ฌ๋ถ ๊ฒฐ์
sharedPreferences.getBoolean("use_dynamic_colors", true)
}
.build()
DynamicColors.applyToActivityIfAvailable(this, dynamicColorOptions)
}
setContentView(R.layout.activity_main)
}
์ด๋ ๊ฒ ํ๋ฉด ์ฌ์ฉ์์ ๋ฐฐ๊ฒฝํ๋ฉด ์์์ ๋ง์ถฐ ์ฑ์ ์์์ด ์๋์ผ๋ก ์กฐ์ ๋ผ! ์ ๋ง ๊ฐ์ธํ๋ ๊ฒฝํ์ ์ ๊ณตํ ์ ์์ด. ๐
โก ํ ๋ง ์ ํ ์ ๋๋ฉ์ด์
ํ ๋ง ์ ํ์ ๋ ๋ถ๋๋ฝ๊ณ ๋ฉ์ง๊ฒ ๋ง๋ค์ด๋ณด์! Circular Reveal ์ ๋๋ฉ์ด์ ์ ์ฌ์ฉํ๋ฉด ์ ๋ง ์ธ๋ จ๋ ํจ๊ณผ๋ฅผ ๋ผ ์ ์์ด:
fun animateThemeChange(view: View, newThemeMode: Int) {
// ํด๋ฆญํ ์์น๋ฅผ ์ค์ฌ์ผ๋ก ์ํ ์ ๋๋ฉ์ด์
val cx = view.width / 2
val cy = view.height / 2
val finalRadius = hypot(cx.toDouble(), cy.toDouble()).toFloat()
// ์ค๋ฒ๋ ์ด ๋ทฐ ์์ฑ
val overlay = View(this).apply {
layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT
)
setBackgroundColor(
if (newThemeMode == AppCompatDelegate.MODE_NIGHT_YES)
Color.parseColor("#121212")
else
Color.WHITE
)
}
(window.decorView as ViewGroup).addView(overlay)
// Circular Reveal ์ ๋๋ฉ์ด์
val anim = ViewAnimationUtils.createCircularReveal(
overlay,
cx,
cy,
0f,
finalRadius
).apply {
duration = 400
interpolator = AccelerateDecelerateInterpolator()
}
anim.doOnEnd {
// ์ ๋๋ฉ์ด์
์๋ฃ ํ ํ
๋ง ๋ณ๊ฒฝ
AppCompatDelegate.setDefaultNightMode(newThemeMode)
(window.decorView as ViewGroup).removeView(overlay)
}
anim.start()
}
์ด ์ ๋๋ฉ์ด์ ์ ์ฌ์ฉ์๊ฐ ๋ฒํผ์ ํด๋ฆญํ ์์น์์ ์ํ์ผ๋ก ํผ์ ธ๋๊ฐ๋ฉด์ ํ ๋ง๊ฐ ์ ํ๋ผ. ์ ๋ง ๋ฉ์ง์ง? ๐ญ
๐ ์๋ ํ ๋ง ์ ํ ์ค์ผ์ค๋ง
์ฌ์ฉ์๊ฐ ์ํ๋ ์๊ฐ์ ์๋์ผ๋ก ํ ๋ง๊ฐ ์ ํ๋๋๋ก ํ ์ ์์ด. ์๋ฅผ ๋ค์ด ๋ฐค 10์๋ถํฐ ์์นจ 7์๊น์ง๋ ์๋์ผ๋ก ๋คํฌ ๋ชจ๋๋ก ์ ํํ๋ ๊ฑฐ์ง:
class ThemeScheduler(private val context: Context) {
private val sharedPreferences = context.getSharedPreferences(
"theme_prefs",
Context.MODE_PRIVATE
)
fun scheduleThemeChange() {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
// ๋คํฌ ๋ชจ๋ ์์ ์๊ฐ (22:00)
val darkModeIntent = Intent(context, ThemeChangeReceiver::class.java).apply {
action = "ENABLE_DARK_MODE"
}
val darkModePendingIntent = PendingIntent.getBroadcast(
context,
0,
darkModeIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val darkModeTime = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, 22)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
// ์ด๋ฏธ ์ง๋ ์๊ฐ์ด๋ฉด ๋ค์ ๋ ๋ก ์ค์
if (before(Calendar.getInstance())) {
add(Calendar.DAY_OF_MONTH, 1)
}
}
alarmManager.setRepeating(
AlarmManager.RTC_WAKEUP,
darkModeTime.timeInMillis,
AlarmManager.INTERVAL_DAY,
darkModePendingIntent
)
// ๋ผ์ดํธ ๋ชจ๋ ์์ ์๊ฐ (07:00)
val lightModeIntent = Intent(context, ThemeChangeReceiver::class.java).apply {
action = "ENABLE_LIGHT_MODE"
}
val lightModePendingIntent = PendingIntent.getBroadcast(
context,
1,
lightModeIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val lightModeTime = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, 7)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
if (before(Calendar.getInstance())) {
add(Calendar.DAY_OF_MONTH, 1)
}
}
alarmManager.setRepeating(
AlarmManager.RTC_WAKEUP,
lightModeTime.timeInMillis,
AlarmManager.INTERVAL_DAY,
lightModePendingIntent
)
}
}
class ThemeChangeReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
"ENABLE_DARK_MODE" -> {
AppCompatDelegate.setDefaultNightMode(
AppCompatDelegate.MODE_NIGHT_YES
)
}
"ENABLE_LIGHT_MODE" -> {
AppCompatDelegate.setDefaultNightMode(
AppCompatDelegate.MODE_NIGHT_NO
)
}
}
}
}
์ด๋ ๊ฒ ํ๋ฉด ์ฌ์ฉ์๊ฐ ์๋์ผ๋ก ์ ํํ์ง ์์๋ ์๋์ผ๋ก ์๊ฐ์ ๋ง์ถฐ ํ ๋ง๊ฐ ๋ฐ๋์ด! ์ ๋ง ํธ๋ฆฌํ์ง? โฐ
โ ๏ธ ์ฃผ์์ฌํญ: ์๋ ํ ๋ง ์ ํ ๊ธฐ๋ฅ์ ๊ตฌํํ ๋๋ ๋ฐ๋์ ์ฌ์ฉ์์๊ฒ ์ ํ๊ถ์ ์ค์ผ ํด! ์ค์ ์์ ์๋ ์ ํ์ ๋๊ฑฐ๋, ์๊ฐ์ ์ปค์คํฐ๋ง์ด์งํ ์ ์๊ฒ ํด์ฃผ๋ ๊ฒ ์ข์. ๊ฐ์ ๋ก ํ ๋ง๋ฅผ ๋ฐ๊พธ๋ฉด ์ฌ์ฉ์ ๊ฒฝํ์ด ๋๋น ์ง ์ ์์ด. ๐ฏ
๐ก Pro Tip: ํ ๋ง ์ ํ ๊ธฐ๋ฅ์ ๊ตฌํํ ๋๋ ์ฌ์ฉ์์ ์ ํธ๋๋ฅผ ๋ถ์ํด๋ด! Firebase Analytics๋ ๋ค๋ฅธ ๋ถ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํด์ ์ผ๋ง๋ ๋ง์ ์ฌ์ฉ์๊ฐ ๋คํฌ ๋ชจ๋๋ฅผ ์ฌ์ฉํ๋์ง, ์ธ์ ์ ํํ๋์ง ๋ฑ์ ํ์ ํ๋ฉด ๋ ๋์ ๊ธฐ๋ณธ ์ค์ ์ ์ ๊ณตํ ์ ์์ด. ๐
๐ ์ค์ ์์ : ์์ ํ ๋คํฌ ํ ๋ง ์ฑ ๋ง๋ค๊ธฐ
์ด๋ก ์ ์ถฉ๋ถํ ๋ฐฐ์ ์ผ๋, ์ด์ ์ค์ ๋ก ์์ ํ ๋คํฌ ํ ๋ง ์ฑ์ ๋ง๋ค์ด๋ณด์! ๊ฐ๋จํ ๋ฉ๋ชจ ์ฑ์ ์์ ๋ก ์ ์ฒด ๊ตฌํ ๊ณผ์ ์ ์ดํด๋ณผ๊ฒ. ๐
๐ ํ๋ก์ ํธ ๊ตฌ์กฐ
๋จผ์ ํ๋ก์ ํธ์ ๊ธฐ๋ณธ ๊ตฌ์กฐ๋ฅผ ์ค์ ํ์:
// build.gradle (Module)
dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
// ViewModel๊ณผ LiveData
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
// Room Database
implementation 'androidx.room:room-runtime:2.6.1'
kapt 'androidx.room:room-compiler:2.6.1'
implementation 'androidx.room:room-ktx:2.6.1'
}
๐จ ํ ๋ง ์ค์
values/themes.xml๊ณผ values-night/themes.xml์ ์ค์ ํ์:
<!-- values/themes.xml -->
<resources>
<style name="Theme.MemoApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">#6200EE</item>
<item name="colorPrimaryVariant">#3700B3</item>
<item name="colorOnPrimary">#FFFFFF</item>
<item name="colorSecondary">#03DAC6</item>
<item name="colorSecondaryVariant">#018786</item>
<item name="colorOnSecondary">#000000</item>
<item name="colorSurface">#FFFFFF</item>
<item name="colorOnSurface">#000000</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
<!-- values-night/themes.xml -->
<resources>
<style name="Theme.MemoApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">#BB86FC</item>
<item name="colorPrimaryVariant">#3700B3</item>
<item name="colorOnPrimary">#000000</item>
<item name="colorSecondary">#03DAC6</item>
<item name="colorSecondaryVariant">#03DAC6</item>
<item name="colorOnSecondary">#000000</item>
<item name="colorSurface">#121212</item>
<item name="colorOnSurface">#FFFFFF</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
๐ฑ ๋ฉ์ธ ์กํฐ๋นํฐ ๊ตฌํ
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private lateinit var memoAdapter: MemoAdapter
private lateinit var viewModel: MemoViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ์ ์ฅ๋ ํ
๋ง ์ค์ ๋ถ๋ฌ์ค๊ธฐ
loadThemePreference()
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
setupToolbar()
setupRecyclerView()
setupViewModel()
setupFab()
}
private fun loadThemePreference() {
val sharedPreferences = getSharedPreferences("app_prefs", Context.MODE_PRIVATE)
val themeMode = sharedPreferences.getInt(
"theme_mode",
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
)
AppCompatDelegate.setDefaultNightMode(themeMode)
}
private fun setupToolbar() {
setSupportActionBar(binding.toolbar)
supportActionBar?.title = "๋ด ๋ฉ๋ชจ"
}
private fun setupRecyclerView() {
memoAdapter = MemoAdapter(
onItemClick = { memo ->
// ๋ฉ๋ชจ ์์ธ ํ๋ฉด์ผ๋ก ์ด๋
val intent = Intent(this, MemoDetailActivity::class.java).apply {
putExtra("memo_id", memo.id)
}
startActivity(intent)
},
onItemLongClick = { memo ->
// ๋ฉ๋ชจ ์ญ์ ํ์ธ ๋ค์ด์ผ๋ก๊ทธ
showDeleteConfirmDialog(memo)
}
)
binding.recyclerView.apply {
adapter = memoAdapter
layoutManager = LinearLayoutManager(this@MainActivity)
addItemDecoration(
DividerItemDecoration(
this@MainActivity,
DividerItemDecoration.VERTICAL
)
)
}
}
private fun setupViewModel() {
viewModel = ViewModelProvider(this)[MemoViewModel::class.java]
viewModel.allMemos.observe(this) { memos ->
memoAdapter.submitList(memos)
// ๋ฉ๋ชจ๊ฐ ์์ ๋ ์๋ด ๋ฉ์์ง ํ์
binding.emptyView.visibility = if (memos.isEmpty()) {
View.VISIBLE
} else {
View.GONE
}
}
}
private fun setupFab() {
binding.fab.setOnClickListener {
// ์ ๋ฉ๋ชจ ์์ฑ ํ๋ฉด์ผ๋ก ์ด๋
val intent = Intent(this, MemoEditActivity::class.java)
startActivity(intent)
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.main_menu, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_theme -> {
showThemeDialog()
true
}
R.id.action_settings -> {
// ์ค์ ํ๋ฉด์ผ๋ก ์ด๋
startActivity(Intent(this, SettingsActivity::class.java))
true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun showThemeDialog() {
val options = arrayOf(
"๋ผ์ดํธ ๋ชจ๋ โ๏ธ",
"๋คํฌ ๋ชจ๋ ๐",
"์์คํ
์ค์ ๋ฐ๋ฅด๊ธฐ โ๏ธ"
)
val currentMode = AppCompatDelegate.getDefaultNightMode()
val checkedItem = when (currentMode) {
AppCompatDelegate.MODE_NIGHT_NO -> 0
AppCompatDelegate.MODE_NIGHT_YES -> 1
else -> 2
}
MaterialAlertDialogBuilder(this)
.setTitle("ํ
๋ง ์ ํ")
.setSingleChoiceItems(options, checkedItem) { dialog, which ->
val mode = when (which) {
0 -> AppCompatDelegate.MODE_NIGHT_NO
1 -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
// ํ
๋ง ๋ณ๊ฒฝ ์ ์ฉ
AppCompatDelegate.setDefaultNightMode(mode)
// ์ค์ ์ ์ฅ
saveThemePreference(mode)
dialog.dismiss()
}
.show()
}
private fun saveThemePreference(mode: Int) {
val sharedPreferences = getSharedPreferences("app_prefs", Context.MODE_PRIVATE)
sharedPreferences.edit().putInt("theme_mode", mode).apply()
}
private fun showDeleteConfirmDialog(memo: Memo) {
MaterialAlertDialogBuilder(this)
.setTitle("๋ฉ๋ชจ ์ญ์ ")
.setMessage("์ ๋ง๋ก ์ด ๋ฉ๋ชจ๋ฅผ ์ญ์ ํ์๊ฒ ์ต๋๊น?")
.setPositiveButton("์ญ์ ") { _, _ ->
viewModel.delete(memo)
Snackbar.make(
binding.root,
"๋ฉ๋ชจ๊ฐ ์ญ์ ๋์์ต๋๋ค",
Snackbar.LENGTH_SHORT
).show()
}
.setNegativeButton("์ทจ์", null)
.show()
}
}
๐ ๋ ์ด์์ ํ์ผ
<!-- activity_main.xml -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:titleTextColor="?attr/colorOnPrimary" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="@+id/emptyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="๐"
android:textSize="64sp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="๋ฉ๋ชจ๊ฐ ์์ต๋๋ค"
android:textColor="?attr/colorOnSurface"
android:textSize="18sp"
android:layout_marginTop="16dp"
android:alpha="0.6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+ ๋ฒํผ์ ๋๋ฌ ์ ๋ฉ๋ชจ๋ฅผ ์์ฑํ์ธ์"
android:textColor="?attr/colorOnSurface"
android:textSize="14sp"
android:layout_marginTop="8dp"
android:alpha="0.4" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="์ ๋ฉ๋ชจ ์์ฑ"
app:srcCompat="@drawable/ic_add"
app:tint="?attr/colorOnPrimary" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!-- item_memo.xml -->
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardElevation="2dp"
app:cardCornerRadius="8dp"
app:cardBackgroundColor="?attr/colorSurface">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/titleText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnSurface"
android:textSize="18sp"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end" />
<TextView
android:id="@+id/contentText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnSurface"
android:textSize="14sp"
android:maxLines="2"
android:ellipsize="end"
android:layout_marginTop="8dp"
android:alpha="0.7" />
<TextView
android:id="@+id/dateText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/colorOnSurface"
android:textSize="12sp"
android:layout_marginTop="8dp"
android:alpha="0.5" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
๐ก Pro Tip: ์ด ์์ ๋ ๊ธฐ๋ณธ์ ์ธ ๊ตฌ์กฐ๋ง ๋ณด์ฌ์ค. ์ค์ ํ๋ก์ ํธ์์๋ ๋ ๋ง์ ๊ธฐ๋ฅ๋ค(๊ฒ์, ์ ๋ ฌ, ์นดํ ๊ณ ๋ฆฌ ๋ฑ)์ ์ถ๊ฐํ ์ ์์ด. ์ค์ํ ๊ฑด ๋ชจ๋ UI ์์๊ฐ ํ ๋ง ์์ฑ(?attr/)์ ์ฌ์ฉํด์ ๋คํฌ ๋ชจ๋์ ์๋์ผ๋ก ๋์ํ๋ค๋ ์ ์ด์ผ! ๐จ
๐ ์ ๊ทผ์ฑ๊ณผ ์ฌ์ฉ์ ๊ฒฝํ
๋คํฌ ํ ๋ง๋ ๋จ์ํ "๋ฉ์ ธ ๋ณด์ด๋" ๊ธฐ๋ฅ์ด ์๋์ผ. ์ ๊ทผ์ฑ๊ณผ ์ฌ์ฉ์ ๊ฒฝํ์ ํฌ๊ฒ ํฅ์์ํค๋ ์ค์ํ ์์์ง! ๋ชจ๋ ์ฌ์ฉ์๊ฐ ํธ์ํ๊ฒ ์ฑ์ ์ฌ์ฉํ ์ ์๋๋ก ํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์. โฟ
๐๏ธ ์๊ฐ ์ ๊ทผ์ฑ ๊ณ ๋ ค์ฌํญ
๋คํฌ ํ ๋ง๋ฅผ ๊ตฌํํ ๋๋ ๋ค์ํ ์๊ฐ ์กฐ๊ฑด์ ๊ฐ์ง ์ฌ์ฉ์๋ค์ ๊ณ ๋ คํด์ผ ํด:
1. ์๋งน/์์ฝ ์ฌ์ฉ์ ๐จ
์์๋ง์ผ๋ก ์ ๋ณด๋ฅผ ์ ๋ฌํ์ง ๋ง! ์์ด์ฝ, ํ
์คํธ, ํจํด ๋ฑ์ ํจ๊ป ์ฌ์ฉํด์ ์ ๋ณด๋ฅผ ์ ๋ฌํด์ผ ํด.
<!-- ๋์ ์: ์์๋ง์ผ๋ก ์ํ ํ์ -->
<View
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@color/error" />
<!-- ์ข์ ์: ์์ด์ฝ๊ณผ ํจ๊ป ํ์ -->
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_error"
android:tint="@color/error"
android:contentDescription="์ค๋ฅ" />
2. ์ ์๋ ฅ ์ฌ์ฉ์ ๐
์ถฉ๋ถํ ๋๋น๋ฅผ ์ ์งํด์ผ ํด. WCAG 2.1 ๊ธฐ์ค์ ๋ฐ๋ฅด๋ฉด ์ผ๋ฐ ํ
์คํธ๋ ์ต์ 4.5:1, ํฐ ํ
์คํธ๋ ์ต์ 3:1์ ๋๋น์จ์ ์ ์งํด์ผ ํด.
// ๋๋น์จ ์ฒดํฌ ํจ์
fun checkContrast(foreground: Int, background: Int): Double {
val luminance1 = calculateLuminance(foreground)
val luminance2 = calculateLuminance(background)
val lighter = max(luminance1, luminance2)
val darker = min(luminance1, luminance2)
return (lighter + 0.05) / (darker + 0.05)
}
fun calculateLuminance(color: Int): Double {
val red = Color.red(color) / 255.0
val green = Color.green(color) / 255.0
val blue = Color.blue(color) / 255.0
val r = if (red <= 0.03928) red / 12.92 else ((red + 0.055) / 1.055).pow(2.4)
val g = if (green <= 0.03928) green / 12.92 else ((green + 0.055) / 1.055).pow(2.4)
val b = if (blue <= 0.03928) blue / 12.92 else ((blue + 0.055) / 1.055).pow(2.4)
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}
3. ๊ด๊ณผ๋ฏผ์ฑ ์ฌ์ฉ์ โก
๋ฐ์ ์์์ ๊น๋นก์์ด๋ ๊ธ๊ฒฉํ ์์ ๋ณํ๋ฅผ ํผํด์ผ ํด. ์ ๋๋ฉ์ด์
์ ์ฌ์ฉํ ๋๋ ๋ถ๋๋ฝ๊ฒ ์ ํ๋๋๋ก ํด.
๐ TalkBack ์ง์
์๊ฐ ์ฅ์ ์ธ์ ์ํ ์คํฌ๋ฆฐ ๋ฆฌ๋์ธ TalkBack์ด ์ ๋๋ก ์๋ํ๋๋ก ํด์ผ ํด:
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_theme"
android:contentDescription="ํ
๋ง ๋ณ๊ฒฝ"
android:background="?attr/selectableItemBackgroundBorderless" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="๋คํฌ ๋ชจ๋"
android:importantForAccessibility="yes" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider"
android:importantForAccessibility="no" />
๋ชจ๋ ์ธํฐ๋ํฐ๋ธ ์์์๋ ์๋ฏธ ์๋ contentDescription์ ์ ๊ณตํ๊ณ , ์ฅ์์ฉ ์์๋ importantForAccessibility="no"๋ก ์ค์ ํด์ TalkBack์ด ๋ฌด์ํ๋๋ก ํด์ผ ํด! ๐ฏ
โ๏ธ ์ฌ์ฉ์ ์ค์ ์กด์คํ๊ธฐ
์์คํ ์ค์ ์ ์กด์คํ๋ ๊ฒ๋ ์ค์ํด. ์ฌ์ฉ์๊ฐ ์์คํ ์์ ์ค์ ํ ์ ๊ทผ์ฑ ์ต์ ๋ค์ ํ์ธํ๊ณ ๋์ํด์ผ ํด:
fun checkAccessibilitySettings(context: Context) {
// ํฐ ํ
์คํธ ์ค์ ํ์ธ
val fontScale = context.resources.configuration.fontScale
if (fontScale > 1.3f) {
// ํฐ ํ
์คํธ ๋ชจ๋: ๋ ์ด์์ ์กฐ์
adjustLayoutForLargeText()
}
// ์ ๋๋ฉ์ด์
๊ฐ์ ์ค์ ํ์ธ
val animationScale = Settings.Global.getFloat(
context.contentResolver,
Settings.Global.ANIMATOR_DURATION_SCALE,
1.0f
)
if (animationScale == 0f) {
// ์ ๋๋ฉ์ด์
๋นํ์ฑํ
disableAnimations()
}
// ๊ณ ๋๋น ๋ชจ๋ ํ์ธ (Android 10+)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val uiModeManager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
if (uiModeManager.isNightMode) {
// ๊ณ ๋๋น ์์ ์ฌ์ฉ
useHighContrastColors()
}
}
}
โ ๏ธ ์ฃผ์์ฌํญ: ์ ๊ทผ์ฑ์ "์ถ๊ฐ ๊ธฐ๋ฅ"์ด ์๋๋ผ ํ์ ์์์ผ! ์ ์ธ๊ณ ์ธ๊ตฌ์ ์ฝ 15%๊ฐ ์ด๋ค ํํ๋ก๋ ์ฅ์ ๋ฅผ ๊ฐ์ง๊ณ ์์ด. ์ ๊ทผ์ฑ์ ๊ณ ๋ คํ์ง ์์ผ๋ฉด ์ด ๋ง์ ์ฌ์ฉ์๋ค์ ๋ฐฐ์ ํ๋ ๊ฑฐ์ผ. ์ฒ์๋ถํฐ ์ ๊ทผ์ฑ์ ์ผ๋์ ๋๊ณ ๊ฐ๋ฐํ๋ฉด ๋์ค์ ์์ ํ๋ ๊ฒ๋ณด๋ค ํจ์ฌ ์ฌ์! โฟ
๐ ์ฑ๋ฅ ์ต์ ํ
๋คํฌ ํ ๋ง๊ฐ ์๋ฌด๋ฆฌ ๋ฉ์ ธ๋ ์ฑ๋ฅ์ด ๋์๋ฉด ์์ฉ์์ด! ํนํ ํ ๋ง ์ ํ ์ ๋ฐ์ํ ์ ์๋ ์ฑ๋ฅ ๋ฌธ์ ๋ค์ ์ต์ ํํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์. โก
๐ ๋ฆฌ์์ค ๋ก๋ฉ ์ต์ ํ
ํ ๋ง๊ฐ ์ ํ๋ ๋๋ง๋ค ๋ชจ๋ ๋ฆฌ์์ค๋ฅผ ๋ค์ ๋ก๋ํ๋ฉด ์ฑ๋ฅ์ด ์ ํ๋ ์ ์์ด. ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๋ ๋ฐฉ๋ฒ:
class ResourceCache(private val context: Context) {
private val colorCache = mutableMapOf<Int, Int>()
private val drawableCache = mutableMapOf<Int, Drawable>()
fun getColor(@ColorRes colorRes: Int): Int {
return colorCache.getOrPut(colorRes) {
ContextCompat.getColor(context, colorRes)
}
}
fun getDrawable(@DrawableRes drawableRes: Int): Drawable? {
return drawableCache.getOrPut(drawableRes) {
ContextCompat.getDrawable(context, drawableRes) ?: return null
}
}
fun clearCache() {
colorCache.clear()
drawableCache.clear()
}
// ํ
๋ง ๋ณ๊ฒฝ ์ ํธ์ถ
fun onThemeChanged() {
clearCache()
}
}
ํ์ง๋ง ์ฃผ์ํด! ์บ์๋ฅผ ๋๋ฌด ๋ง์ด ์ฌ์ฉํ๋ฉด ๋ฉ๋ชจ๋ฆฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ด. ์ ์ ํ ๊ท ํ์ ์ฐพ๋ ๊ฒ ์ค์ํด. ๐ฏ
๐จ ๋๋ก์ด๋ธ ์ต์ ํ
๋ฒกํฐ ๋๋ก์ด๋ธ์ ํฌ๊ธฐ๊ฐ ์๊ณ ํ์ฅ์ฑ์ด ์ข์ง๋ง, ๋ณต์กํ ๊ฒฝ์ฐ ๋ ๋๋ง ์ฑ๋ฅ์ด ๋จ์ด์ง ์ ์์ด. ์ต์ ํ ํ:
1. ๋ฒกํฐ ๋๋ก์ด๋ธ ์ฌ์ ๋ ๋๋ง ๐ผ๏ธ
// ๋ณต์กํ ๋ฒกํฐ ๋๋ก์ด๋ธ์ ๋นํธ๋งต์ผ๋ก ๋ณํ
fun vectorToBitmap(context: Context, @DrawableRes drawableRes: Int): Bitmap {
val drawable = ContextCompat.getDrawable(context, drawableRes) ?:
throw IllegalArgumentException("Drawable not found")
val bitmap = Bitmap.createBitmap(
drawable.intrinsicWidth,
drawable.intrinsicHeight,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(bitmap)
drawable.setBounds(0, 0, canvas.width, canvas.height)
drawable.draw(canvas)
return bitmap
}
2. ์ ์ ํ ์ด๋ฏธ์ง ํฌ๋งท ์ ํ ๐ฆ
โข ๋จ์ํ ์์ด์ฝ: ๋ฒกํฐ ๋๋ก์ด๋ธ (SVG)
โข ๋ณต์กํ ์ผ๋ฌ์คํธ: WebP (์์ค ์์ถ)
โข ํฌ๋ช ๋๊ฐ ํ์ํ ์ด๋ฏธ์ง: WebP (๋ฌด์์ค ์์ถ)
โข ์ฌ์ง: JPEG ๋๋ WebP
โก ๋ ์ด์์ ์ธํ๋ ์ด์ ์ต์ ํ
ํ ๋ง๊ฐ ๋ณ๊ฒฝ๋๋ฉด ์กํฐ๋นํฐ๊ฐ ์ฌ์์ฑ๋๋ฉด์ ๋ชจ๋ ๋ ์ด์์์ด ๋ค์ ์ธํ๋ ์ดํธ๋ผ. ์ด ๊ณผ์ ์ ์ต์ ํํ๋ ๋ฐฉ๋ฒ:
// ViewBinding ์ฌ์ฉ์ผ๋ก findViewById ํธ์ถ ์ต์ํ
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ViewBinding์ผ๋ก ํ ๋ฒ์ ๋ชจ๋ ๋ทฐ ์ฐธ์กฐ
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
// findViewById ๋์ binding ์ฌ์ฉ
binding.textView.text = "Hello"
binding.button.setOnClickListener { }
}
}
// ConstraintLayout ์ฌ์ฉ์ผ๋ก ๋ทฐ ๊ณ์ธต ํํํ
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- ์ค์ฒฉ๋ LinearLayout ๋์ ConstraintLayout ์ฌ์ฉ -->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
๐ก Pro Tip: Android Studio์ Profiler๋ฅผ ์ฌ์ฉํด์ ํ ๋ง ์ ํ ์ ์ฑ๋ฅ์ ์ธก์ ํด๋ด! CPU, ๋ฉ๋ชจ๋ฆฌ, ๋คํธ์ํฌ ์ฌ์ฉ๋์ ์ค์๊ฐ์ผ๋ก ๋ชจ๋ํฐ๋งํ ์ ์์ด. ๋ณ๋ชฉ ์ง์ ์ ์ฐพ์์ ์ต์ ํํ๋ฉด ํจ์ฌ ๋ถ๋๋ฌ์ด ์ฌ์ฉ์ ๊ฒฝํ์ ์ ๊ณตํ ์ ์์ด! ๐
๐ ๋ง์น๋ฉฐ
์! ์ฌ๊ธฐ๊น์ง ์ฝ์๋ค๋ฉด ๋น์ ์ ์ด์ ์๋๋ก์ด๋ ๋คํฌ ํ ๋ง์ ์ ๋ฌธ๊ฐ์ผ! ๐ ์ ๋ง ๊ธด ์ฌ์ ์ด์์ง๋ง, ์ด์ ์ฌ์ฉ์๋ค์ด ๋ฐค์๋ ํธ์ํ๊ฒ ์ฌ์ฉํ ์ ์๋ ๋ฉ์ง ์ฑ์ ๋ง๋ค ์ ์์ ๊ฑฐ์ผ.
๐ ํต์ฌ ์์ฝ
๋คํฌ ํ ๋ง ๊ตฌํ์ ํต์ฌ ํฌ์ธํธ๋ฅผ ๋ค์ ํ๋ฒ ์ ๋ฆฌํด๋ณผ๊ฒ:
1. DayNight ํ
๋ง ์ฌ์ฉ ๐
Theme.MaterialComponents.DayNight๋ฅผ ๋ถ๋ชจ ํ
๋ง๋ก ์ฌ์ฉํ๊ณ , values-night ํด๋์ ๋คํฌ ํ
๋ง ๋ฆฌ์์ค๋ฅผ ์ ์ํด.
2. ํ
๋ง ์์ฑ ํ์ฉ ๐จ
ํ๋์ฝ๋ฉ๋ ์์ ๋์ ?attr/colorPrimary ๊ฐ์ ํ
๋ง ์์ฑ์ ์ฌ์ฉํด. ์ด๊ฒ ๋คํฌ ํ
๋ง์ ํต์ฌ์ด์ผ!
3. ์๋งจํฑ ๋ค์ด๋ฐ ๐
์์ ์ด๋ฆ์ "blue", "red"๊ฐ ์๋๋ผ "primary", "surface", "text_primary" ๊ฐ์ ์ฉ๋ ๊ธฐ๋ฐ์ผ๋ก ์ง์ด.
4. ์ด๋ฏธ์ง์ ์์ด์ฝ ๋์ ๐ผ๏ธ
drawable-night ํด๋๋ฅผ ํ์ฉํ๊ฑฐ๋ ๋ฒกํฐ ๋๋ก์ด๋ธ์ ํดํธ๋ฅผ ์ฌ์ฉํด์ ํ
๋ง์ ๋ง๊ฒ ์กฐ์ ํด.
5. ์ ๊ทผ์ฑ ๊ณ ๋ ค โฟ
์ถฉ๋ถํ ๋๋น๋ฅผ ์ ์งํ๊ณ , TalkBack์ ์ง์ํ๋ฉฐ, ์ฌ์ฉ์์ ์ ๊ทผ์ฑ ์ค์ ์ ์กด์คํด.
6. ์ฑ๋ฅ ์ต์ ํ โก
๋ฆฌ์์ค ์บ์ฑ, ViewBinding ์ฌ์ฉ, ๋ ์ด์์ ์ต์ ํ๋ก ๋ถ๋๋ฌ์ด ์ ํ์ ๊ตฌํํด.
7. ์ฒ ์ ํ ํ
์คํธ ๐งช
๋ค์ํ ๊ธฐ๊ธฐ์ ์๋๋ก์ด๋ ๋ฒ์ ์์ ํ
์คํธํ๊ณ , ์ค์ ์ฌ์ฉ์ ํผ๋๋ฐฑ์ ์์งํด.
๐ ๋ค์ ๋จ๊ณ
๋คํฌ ํ ๋ง ๊ตฌํ์ ๋ง์คํฐํ๋ค๋ฉด, ๋ค์ ๋จ๊ณ๋ก ๋์๊ฐ๋ณด์:
Material You ์ ์ฉ ๐จ
Android 12 ์ด์์์ ๋์ ์์ ์์คํ
์ ํ์ฉํด์ ๋์ฑ ๊ฐ์ธํ๋ ๊ฒฝํ์ ์ ๊ณตํด๋ด.
์ปค์คํ
ํ
๋ง ๋ง๋ค๊ธฐ ๐ญ
์ฌ์ฉ์๊ฐ ์ง์ ์์์ ์ ํํ ์ ์๋ ํ
๋ง ์ปค์คํฐ๋ง์ด์ง ๊ธฐ๋ฅ์ ์ถ๊ฐํด๋ด.
Jetpack Compose๋ก ์ ํ ๐
Compose์์๋ ํ
๋ง ๊ด๋ฆฌ๊ฐ ๋์ฑ ๊ฐํธํด. CompositionLocal์ ์ฌ์ฉํ ํ
๋ง ์์คํ
์ ๋ฐฐ์๋ด.
ํฌ๋ก์ค ํ๋ซํผ ๊ณ ๋ ค ๐
Flutter๋ React Native์์๋ ๋คํฌ ํ
๋ง๋ฅผ ๊ตฌํํด๋ณด๋ฉด์ ํ๋ซํผ ๊ฐ ์ผ๊ด์ฑ์ ์ ์งํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์๋ด.
๐ฌ ์ปค๋ฎค๋ํฐ์ ํจ๊ปํ๊ธฐ
ํผ์์ ๋ชจ๋ ๊ฑธ ํด๊ฒฐํ๋ ค๊ณ ํ์ง ๋ง! ๊ฐ๋ฐ์ ์ปค๋ฎค๋ํฐ๋ ์ ๋ง ๋์์ด ๋ง์ด ๋ผ:
โข Stack Overflow: ๊ตฌ์ฒด์ ์ธ ๊ธฐ์ ๋ฌธ์ ํด๊ฒฐ
โข Reddit (r/androiddev): ์ต์ ํธ๋ ๋์ ๋ฒ ์คํธ ํ๋ํฐ์ค ๊ณต์
โข Android Developers Blog: ๊ณต์ ๊ฐ์ด๋๋ผ์ธ๊ณผ ์
๋ฐ์ดํธ
โข GitHub: ์คํ์์ค ํ๋ก์ ํธ์์ ์ค์ ๊ตฌํ ์ฌ๋ก ํ์ต
โข ์ฌ๋ฅ๋ท: ์ ๋ฌธ๊ฐ์ 1:1 ์ฝ์นญ์ด๋ ์ฝ๋ ๋ฆฌ๋ทฐ ๋ฐ๊ธฐ ๐
ํนํ ์ฌ๋ฅ๋ท์์๋ ์๋๋ก์ด๋ ๊ฐ๋ฐ ์ ๋ฌธ๊ฐ๋ค์ด ์ค์๊ฐ์ผ๋ก ๋์์ ์ค ์ ์์ด. ๋งํ๋ ๋ถ๋ถ์ด ์๊ฑฐ๋ ์ฝ๋ ๋ฆฌ๋ทฐ๊ฐ ํ์ํ๋ค๋ฉด ์ ๋ฌธ๊ฐ์ ๋์์ ๋ฐ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด์ผ! ๐ช
๐ก ๋ง์ง๋ง ์กฐ์ธ: ๋คํฌ ํ
๋ง๋ ๋จ์ํ "ํธ๋ ๋ํ" ๊ธฐ๋ฅ์ด ์๋๋ผ, ์ฌ์ฉ์ ๊ฒฝํ์ ๊ทผ๋ณธ์ ์ผ๋ก ๊ฐ์ ํ๋ ์ค์ํ ์์์ผ. ์ฒ์์๋ ๋ณต์กํด ๋ณด์ผ ์ ์์ง๋ง, ํ ๋ฒ ์ ๋๋ก ๊ตฌํํด๋๋ฉด ์ฌ์ฉ์๋ค์ด ์ ๋ง ๊ณ ๋ง์ํ ๊ฑฐ์ผ. ํนํ ๋ฐค์ ์ฑ์ ์ฌ์ฉํ๋ ์ฌ์ฉ์๋ค์ ๋คํฌ ๋ชจ๋๊ฐ ์๋ ์ฑ์ ์ฌ์ฉํ๊ธฐ ์ซ์ดํ ์ ๋๋ก ์ค์ํ ๊ธฐ๋ฅ์ด ๋์์ด! ๐
๊ณ์ ๋ฐฐ์ฐ๊ณ , ์คํํ๊ณ , ๊ฐ์ ํด๋๊ฐ์. ์๋ฒฝํ ๋คํฌ ํ
๋ง๋ ํ ๋ฒ์ ๋ง๋ค์ด์ง์ง ์์. ์ฌ์ฉ์ ํผ๋๋ฐฑ์ ๋ฃ๊ณ , ๋ฐ์ดํฐ๋ฅผ ๋ถ์ํ๊ณ , ์ง์์ ์ผ๋ก ๊ฐ์ ํด๋๊ฐ๋ ๊ณผ์ ์ด ์ค์ํด. ๋น์ ์ ์ฑ์ด ์ฌ์ฉ์๋ค์๊ฒ ์ต๊ณ ์ ๊ฒฝํ์ ์ ๊ณตํ๊ธธ ๋ฐ๋ผ! ๐
ํ๋ณตํ ์ฝ๋ฉ ๋์ธ์! ๐โจ
๊ด๋ จ ํค์๋
๋๊ธ ์์ฑ
์ด ๊ธ์ ๋ํ ์ฌ๋ฌ๋ถ์ ์๊ฐ์ ๋ค๋ ค์ฃผ์ธ์
๋ก๊ทธ์ธ์ด ํ์ํฉ๋๋ค
๋๊ธ์ ์์ฑํ๋ ค๋ฉด ๋จผ์ ๋ก๊ทธ์ธํด์ฃผ์ธ์.
๋๊ธ 0
์ง์์ธ์ ์ฒ - ์ง์ ์ฌ์ฐ๊ถ ๋ณดํธ ๊ณ ์ง
์ง์ ์ฌ์ฐ๊ถ ๋ณดํธ ๊ณ ์ง
- ์ ์๊ถ ๋ฐ ์์ ๊ถ: ๋ณธ ์ปจํ ์ธ ๋ ์ฌ๋ฅ๋ท์ ๋ ์ AI ๊ธฐ์ ๋ก ์์ฑ๋์์ผ๋ฉฐ, ๋ํ๋ฏผ๊ตญ ์ ์๊ถ๋ฒ ๋ฐ ๊ตญ์ ์ ์๊ถ ํ์ฝ์ ์ํด ๋ณดํธ๋ฉ๋๋ค.
- AI ์์ฑ ์ปจํ ์ธ ์ ๋ฒ์ ์ง์: ๋ณธ AI ์์ฑ ์ปจํ ์ธ ๋ ์ฌ๋ฅ๋ท์ ์ง์ ์ฐฝ์๋ฌผ๋ก ์ธ์ ๋๋ฉฐ, ๊ด๋ จ ๋ฒ๊ท์ ๋ฐ๋ผ ์ ์๊ถ ๋ณดํธ๋ฅผ ๋ฐ์ต๋๋ค.
- ์ฌ์ฉ ์ ํ: ์ฌ๋ฅ๋ท์ ๋ช ์์ ์๋ฉด ๋์ ์์ด ๋ณธ ์ปจํ ์ธ ๋ฅผ ๋ณต์ , ์์ , ๋ฐฐํฌ, ๋๋ ์์ ์ ์ผ๋ก ํ์ฉํ๋ ํ์๋ ์๊ฒฉํ ๊ธ์ง๋ฉ๋๋ค.
- ๋ฐ์ดํฐ ์์ง ๊ธ์ง: ๋ณธ ์ปจํ ์ธ ์ ๋ํ ๋ฌด๋จ ์คํฌ๋ํ, ํฌ๋กค๋ง, ๋ฐ ์๋ํ๋ ๋ฐ์ดํฐ ์์ง์ ๋ฒ์ ์ ์ฌ์ ๋์์ด ๋ฉ๋๋ค.
- AI ํ์ต ์ ํ: ์ฌ๋ฅ๋ท์ AI ์์ฑ ์ปจํ ์ธ ๋ฅผ ํ AI ๋ชจ๋ธ ํ์ต์ ๋ฌด๋จ ์ฌ์ฉํ๋ ํ์๋ ๊ธ์ง๋๋ฉฐ, ์ด๋ ์ง์ ์ฌ์ฐ๊ถ ์นจํด๋ก ๊ฐ์ฃผ๋ฉ๋๋ค.
์์ง ๋๊ธ์ด ์์ต๋๋ค.