๊ด€๋ฆฌ ๋ฉ”๋‰ด

ruriruriya

[Android] ์•ˆ๋“œ๋กœ์ด๋“œ - ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ํฐํŠธ ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•(feat. fontFamily) ๋ณธ๋ฌธ

๐Ÿค–Android

[Android] ์•ˆ๋“œ๋กœ์ด๋“œ - ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ํฐํŠธ ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•(feat. fontFamily)

๋ฃจ๋ฆฌ์•ผใ…‘ 2024. 2. 4. 22:41
๋ฐ˜์‘ํ˜•

์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ ๊ฐœ๋ฐœ ์‹œ ๋งˆ์Œ์— ๋“œ๋Š” ํฐํŠธ๋ฅผ ์ ์šฉ์‹œ์ผœ ์ข€๋” ๋น„์ฃผ์–ผ์ ์œผ๋กœ ๋ณด์ด๋„๋ก ํ•ด๋ณด์ž.

 

1. res - fontํด๋”

- fontํด๋”๋ฅผ ์ƒ์„ฑ


- ๋ณต์‚ฌ(ctrl+ c)ํ•ด์„œ fontํด๋”๋ฅผ ์„ ํƒ ํ›„ ๋ถ™์—ฌ๋„ฃ๊ธฐ(ctrl+v)๋ฅผ ํ•ด์ค€๋‹ค.

-  ๊ทธ๋ฆฌ๊ณ  ํŒŒ์ผ์˜ ์˜ค๋ฅธ์ชฝ ๋งˆ์šฐ์Šค๋ฅผ ๋ˆŒ๋Ÿฌ refactor -rename์œผ๋กœ
๋ชจ๋‘ ์†Œ๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค.

 

2. ํ•ด๋‹น xml

fontFamily๋กœ ํฐํŠธํด๋”์— ์žˆ๋Š” ํด๋”๋ฅผ ์ง€์ •ํ•˜์—ฌ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="๊ธฐ์กด ๊ธ€์ž์ฒด"
        android:textSize="34sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.387" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/seolleimcool"
        android:text="ํฐํŠธ ์ ์šฉ"
        android:textColor="#2196F3"
        android:textSize="34sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.48" />

</androidx.constraintlayout.widget.ConstraintLayout>

 

3. ์ ์šฉํ™”๋ฉด

์ด๋ ‡๊ฒŒ ์›ํ•˜๋Š” ํฐํŠธ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค!

 

๋ฐ˜์‘ํ˜•