我想設置不同的字體樣式我的'按鈕'文本和'編輯文本框'文本像時代的新羅馬,Calibri,坎布里亞和格魯吉亞。我如何設置不同的字體,例如我想將我的登錄按鈕文本更改爲Calibri字體。我不知道如何設置或從MS Office或字體文件導入字體。請給我建議,謝謝。如何在Android中設置自定義不同的字體樣式
我的XML代碼在這裏
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint=" User Name " />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint=" Password "
android:fontFamily="Tekton Pro Ext"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="Tekton Pro Ext"
android:text=" Login " />
</LinearLayout>
佈局
如何使用這個構造函數類的所有文本字段可以訪問我的項目的所有文本視圖? – wingsraam
只需使用您的自定義文本視圖類名稱替換XML佈局中的TextView標記即可。您可以將其用作普通文本視圖,例如。 'TextView tv =(TextView)findViewById(R.id.stylisedTextView)''。我想你現在可以實現按鈕或任何你想要的自己。 –
任何可能爲新字體添加直接的XML文本視圖 – wingsraam