私の全体プロジェクトのフォントを変更するには、chrisjenx/Calligraphy in Themeを使います。Android chrisjenx/Calligraphy Themeで定義されたカスタムフォントTheme.AppCompatが動作しない
私は指示に従ったが、それはここに私のため
を働いていない私のコードです:アプリケーション内の
:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(base));
}
@Override
public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("BElham.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
ここに私のスタイルは、最初に作成し、これを試してください
<!-- Base application theme. -->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">>
<item name="android:textViewStyle">@style/AppTheme.Widget.TextView</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Widget"/>
<style name="AppTheme.Widget.TextView" parent="android:Widget.TextView">
<item name="fontPath">BElham.ttf</item>
</style>
http://mobikul.com/android-calligraphy/ – Killer