2012-09-29 54 views

回答

0

創建一個字體,然後到你的EditText應用它,如下所示: -

Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "font.ttf"); 
editText.setTypeface(tf); 
+0

@ user1437739,你將不得不提供TTF字庫將資產文件夾爲好,或'getAssets'電話會返回一個異常 – mrres1

+0

謝謝4重新申請,但我得到forceclose如果我使用字體.. :( – user1437739

+0

您需要將您的字體放置在資產文件夾中,所以命名您的字體爲「font.ttf」,然後將其放置在資產文件夾中。 否則,如果你沒有你自己的字體,那麼你可以使用android提供的字體,只需使用editText.setTypeface(Typeface.BOLD); http://developer.android.com/reference/android/graphics/Typeface.html 看看這個 –

0
<TextView 
    ... 
    android:typeface="sans" 
/>