アプリケーションにApiクラスがあります。Apiクラス内には、静的として設定されたカスタム フォントがあります。例えば:
public static Typeface fontShort;
public Api(Context c, Display d) {
// I want to change this if user wants to keep using system font style or my custom style
if (shouldKeepCurrent == true) {
// Use system default font
fontTitle = // ???
} else {
// Use my costume font
fontTitle = Typeface.createFromAsset(context.getAssets(), "fonts/custom.ttf");
}
}
ユーザーがカスタム フォントを使用したくない場合、デバイスのデフォルトおよび現在の書体を取得したい!
アクティビティ クラス:
TextView myView = (TextView) findViewById(R.id.myView);
// Change to custom font style or keep current font style
myView.setTypeface(Api.fontTitle);
何か案は?