android冰淇淋三明治版本中自定义字体显示不正确

android冰淇淋三明治版本中自定义字体显示不正确,android,fonts,Android,Fonts,大家好, 在我的应用程序中,我设置了一个自定义字体,但问题是android冰激凌三明治版本没有显示正确的文本或变得模糊,但在棒棒糖版本中,它工作正常。谁都知道冰淇淋三明治版本有什么问题 对于自定义字体,我使用了TypefaceManager类和以下代码 <com.ex.new.textstyleUtil.TypefaceTextView android:layout_width="match_parent" android:l

大家好, 在我的应用程序中,我设置了一个自定义字体,但问题是android冰激凌三明治版本没有显示正确的文本或变得模糊,但在棒棒糖版本中,它工作正常。谁都知道冰淇淋三明治版本有什么问题

对于自定义字体,我使用了TypefaceManager类和以下代码

<com.ex.new.textstyleUtil.TypefaceTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="normal"
                android:padding="@dimen/padding_2"
                android:text="@string/receiver_info"
                android:textColor="@color/mainColor"
                android:textSize="@dimen/text_16" />



public void applyTypeface(TextView textView, TextStyle textStyle){
    final Typeface typeface = getTypeface(textView.getContext(), textStyle);
    if (typeface != null) {
        textView.setTypeface(typeface);
    }}

public class TypefaceTextView extends TextView {

public TypefaceTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypefaceManager.getInstance().applyTypeface(this, context, attrs);
}

/**
 * Convenience method in case I need to change the font from code as well.
 * @param textStyle
 */
public void setTextStyle(TextStyle textStyle) {
    TypefaceManager.getInstance().applyTypeface(this, textStyle);
}}


public enum CooperHewittTextStyle implements TextStyle {

NORMAL("normal", "CooperHewitt-Book.ttf"),
BOLD("bold", "CooperHewitt-Bold.ttf");

private String mName;
private String mFontName;

CooperHewittTextStyle(String name, String fontName) {
    mName = name;
    mFontName = fontName;
}

@Override
public String getFontName() {
    return mFontName;
}

@Override
public String getName() {
    return mName;
}}

public void applyTypeface(TextView TextView,TextStyle TextStyle){
final-Typeface-Typeface=getTypeface(textView.getContext(),textStyle);
如果(字体!=null){
textView.setTypeface(字体);
}}
公共类TypefaceTextView扩展了TextView{
公共TypefaceTextView(上下文、属性集属性){
超级(上下文,attrs);
TypefaceManager.getInstance().applyTypeface(this,context,attrs);
}
/**
*方便的方法,以防我需要改变从代码的字体以及。
*@param textStyle
*/
public void setTextStyle(TextStyle TextStyle){
TypefaceManager.getInstance().applyTypeface(这是textStyle);
}}
公共枚举CooperHewittTextStyle实现TextStyle{
正常(“正常”,“CooperHewitt Book.ttf”),
粗体(“粗体”、“库珀休伊特粗体.ttf”);
私有字符串mName;
私有字符串mFontName;
CooperHewittTextStyle(字符串名称、字符串名称){
mName=名称;
mFontName=fontName;
}
@凌驾
公共字符串getFontName(){
返回mFontName;
}
@凌驾
公共字符串getName(){
返回mName;
}}