Android アプリケーションのすべてのビューに Roboto フォントを使用したいのですが、どうすればよいですか?
			
			1379 次
		
2 に答える
            1        
        
		
TextView、EditText などのカスタム ビューを作成します。次に、以下の setTypeface の例をコンストラクターに設定します。
public class RobotoTextView extends TextView {
    public RobotoTextView(Context context) {
        super(context);
        setTypeface(Typeface
                .createFromAsset(context.getAssets(), "fontname.ttf"));
    }
}
そして、標準の TextView を使用する代わりに、レイアウトでこれを使用するだけで、以下のカスタム クラスの例を使用できます。
<packagename.RobotoTextView
            style="@style/usecustomstyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/yourid"/>
    于 2013-02-01T16:09:54.743   に答える
    
    
            0        
        
		
タイプフェイスを使用します。フォント ファイルを assest フォルダーに配置します。そして、以下のコードを書きます。
 Typeface Roboto = Typeface.createFromAsset(getAssets(), "Roboto.ttf"); 
そして、Roboto フォントをすべて使用しTextViewますEditText。
  Textview.setTypeface(italic);  
    于 2013-02-01T16:08:28.103   に答える