2013-02-26 36 views
0

如果我有一些諸如:給文字顏色

TextView description_label; 
description_label.setText("Information"); 

如何選擇/設置文本的顏色。例如。有'信息'綠色

+3

嘗試查看有關對象的文檔,然後再發布此處。很多時候這些簡單的問題都可以在那裏得到解答。 http://developer.android.com/reference/android/widget/TextView.html – dymmeh 2013-02-26 20:20:46

+0

你可能看看這些線程http://stackoverflow.com/questions/4602902/how-to-set-text-color- of-textview-in-code和http://developer.android.com/reference/android/graphics/Color.html – 2013-02-26 20:30:32

回答

3

請致電description.setTextColor()。或者在xml中使用android:textColor

0
TextView description_label; 
description_label.setTextColor(Color.GREEN); 
description_label.setText("Information");