Notice
Recent Comments
Link
JY-Dev Tech Blog
안드로이드(Android) - font 적용시키기 본문
[OverView]
오늘은 어플리케이션에 font를 적용하는 방법에 대해 알려드리겠습니다.
일단 res폴더에 새로 font라는 디렉토리를 만들어줍니다.
그 다음은 사용할 ttf 파일을 font폴더 안에다 넣어줍니다.
[XML] 방식
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:fontFamily="@font/font"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
이런식으로 fontFamily 안에서 불러오시면 됩니다.
[Code] 방식
val typeFace = ResourcesCompat.getFont(context,R.font.font)
tv.typeface = typeFace
이렇게 typeface를 선언해서 해줄수 있습니다.
'안드로이드 > 레이아웃' 카테고리의 다른 글
안드로이드(Android) - Navigation 사용법 (0) | 2020.11.09 |
---|---|
안드로이드(Android) - RelativeLayout set LayoutParams Programmatically (마진값 코드상으로 변경하는법 , LayoutParams 설정법) (0) | 2020.10.12 |
안드로이드(Android) - infinite circuler progressbar (0) | 2020.09.24 |
안드로이드(Android) - Drawable Shape Color Change (0) | 2020.09.07 |
안드로이드(Android) - SearchView TextStyle 변경 (0) | 2020.08.14 |
Comments