2013-10-17 57 views

回答

0

這將顏色從XML改變:

<TextView 
android:layout_width="wrap_content" 
android:layout_height"wrap_content" 
android:textColor="#123123" 
/> 

更改字體是多一點點深入。將所需的字體文件放入項目的assets文件夾中,並使用TextView的setTypeface()方法。這在前面的問題中已經得到了說明:How to change the font on the TextView?

+0

謝謝。所有樣式都添加到它自己的部分嗎?喜歡是不是有什麼像CSS,你做了一個ID標識的風格,並適用於所有小部件,持有該ID?! –

+0

你可以做類似的事情,請看這裏:http://developer.android.com/guide/topics/ui/themes.html – FoamyGuy

0

好的,這裏是TextView的文檔。基本上有兩種使用xml和java代碼設置文本視圖的方式。這裏是相關的xml屬性:

android:textColor 
android:textColorHighlight 
android:textColorHint 
android:textSize 

依此類推。在代碼上,它看起來像這樣:

TextView tv = (TextView) findViewById(R.id.tv); 
tv.setTextColor(Color.BLACK); 
相關問題