1 답변
-
안드로이드에서 폰트를 바꾸는거는 꽤나 번거로운 작업이 필요합니다. 그렇기에 저는 관련 오픈소스를 추천해드리겠습니다.
https://github.com/tsengvn/Typekit Typekit이라는 오픈소스인데요.
Build.gradle에
compile 'com.tsengvn:Typekit:1.0.0'
만 추가해주시고Application클래스에서
Typekit.getInstance() .addNormal(Typekit.createFromAsset(this, "fonts/NanumBarunGothic-Regular.otf")) .addBold(Typekit.createFromAsset(this, "fonts/NanumBarunGothic-Bold.otf"));
이렇게 적어줍니다. 두번째 매개변수에 원하는 폰트를 넣으시면됩니다.
그리고 각 액티비티마다
@Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(TypekitContextWrapper.wrap(newBase)); }
이 메소드를 오버라이드 시키시면 됩니다.
댓글 입력