안드로이드 외부폰트 적용하기
2015. 9. 2. 00:21
반응형
우선 아래와 같이 asset 폴더에 폰트파일을 추가해준다.
폰트파일의 경로는 C:\Windows\Fonts 여기서 찾을 수 있다.
그런 다음 폰트를 바꾸고 싶은 뷰에다 적용을 해주면되는데 개인적으로 버튼의 텍스트 폰트를 바꾸고 싶었다.
Button btn2 = (Button)findViewById(R.id.button_custom); btn2.setOnClickListener(this); Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/NEXONFootballGothicB.ttf")); //asset > fonts 폴더 내 폰트파일 적용 btn2.setTypeface(typeFace);
위와 같이 버튼에 폰트를 적용하였다.
Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/NEXONFootballGothicB.ttf")); // 폰트 설정 후
btn2.setTypeface(typeFace); //btn2 버튼에 폰트 적용
끝!
반응형
'지식메모 > 안드로이드 Android' 카테고리의 다른 글
안드로이드 sdk 설치시 Download interrupted: peer not authenticated 문제 해결 (0) | 2015.12.15 |
---|---|
안드로이드 APK 재서명하기 (0) | 2015.09.22 |
안드로이드 xml 에러 error: Apostrophe not preceded by 해결 (0) | 2015.09.01 |
안드로이드 시스템 언어 변경에 따라 앱에서도 자동으로 언어 변경하기 (4) | 2015.08.20 |
안드로이드 HashMap 을 이용한 이미지 세팅하기. (0) | 2015.06.28 |