コードのXMLからフォントファミリ名attr名を取得したいとします。 は、たとえば、私は、カスタムのTextViewクラスを持っている:TextViewからfontFamily名を取得する方法は?
public class TextVieww extends TextView{
public TextVieww(Context context) {
super(context);
}
public TextVieww(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TextVieww(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void init(Context mContext ,TextView view) {
}
}
はXML:
<com.typefacetest.TextVieww
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:textStyle="bold"
android:fontFamily="sans-serif-thin"
android:text="Hello World!" />
私はtextView.classから "サンセリフ・シン" を取得したいです。 これは可能ですか?どのようにこれを行うには?感謝の戻ります。まずsetTypeface(Typeface.SANS_SERIF)
アセットフォルダに.ttfファイルを置くtextView.class&call XML上のそれ –
私はちょうどそれを置き換えていない、フォントファミリの現在の名前をしたい – Anna
textView.setTypeface(Typeface.create( "sans-serif-thin"、Typeface.NORMAL));これは好きですか? –