2017-02-06 6 views
0

を使用して遮断:私はこれのTextViewを使用する場合カスタムTextViewには、新しいフォントを追加するために、私はカスタムのTextViewを作成wrap_content

public class CustomTextView extends TextView{ 

    public CustomTextView(Context context, AttributeSet attrs, int defStyle){ 
     super(context, attrs, defStyle); 
     setTypeface(SplashActivity.SECRET_CODE_TYPEFACE, Typeface.NORMAL); 
    } 

    public CustomTextView(Context context, AttributeSet attrs){ 
     super(context, attrs); 
     setTypeface(SplashActivity.SECRET_CODE_TYPEFACE, Typeface.NORMAL); 
    } 

    public CustomTextView(Context context){ 
     super(context); 
     setTypeface(SplashActivity.SECRET_CODE_TYPEFACE, Typeface.NORMAL); 
    } 
} 

は今、テキストが遮断されています Result

<com.whereisthemonkey.sqlsheetmanager.Graphics.CustomTextView 
     android:layout_width="match_parent" 
     android:text="@string/title" 
     android:textSize="56sp" 
     android:layout_height="wrap_content" 
     android:gravity="center" /> 

答えて

2
android:padding="10dp" 

がshoとして、あなたのテキストビューにパディングを追加します。そして、ここで私のXMLであります次のとおりです:

<com.whereisthemonkey.sqlsheetmanager.Graphics.CustomTextView 
     android:layout_width="match_parent" 
     android:text="@string/title" 
     android:textSize="56sp" 
     android:padding="10dp" 
     android:layout_height="wrap_content" 
     android:gravity="center" /> 
+1

ありがとうございます。パディングボトムとパディングトップを使用するとさらに効果的です –

関連する問題