私はハンガリーに住んでいて、ő、ű... などの特殊文字がいくつかあります。
私のAndroidアプリでは、カスタムTextViewを作成しました。このカスタム TextView は、コンストラクターにカスタムの書体を設定し、小さなバグを除いて正常に動作します。
"ő" のような特殊文字は、新しい書体に変換されず、同じデフォルト フォントのままです。
、
(たぶん、いくつかの文字コーディングのことか、私は本当に知りません...)
(私が使用しているフォントは Helvetica Neue Light です。コンピューターの Windows/Fonts フォルダーから開くと、特殊文字が表示されるため、このフォントには「ő」文字が含まれていることを意味しますが、何らかの理由で Android が適切に処理できないことを意味します.)
できれば助けてください!ありがとう!
編集:
私のカスタム textView クラス:
public class FlexiTextView extends TextView {
public FlexiTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initView(context);
}
public FlexiTextView(Context context) {
super(context);
initView(context);
}
public FlexiTextView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
private void initView(Context context) {
try {
Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/helveticaneue.ttf");
this.setTypeface(typeface);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}