2011-04-19 76 views
1

textView中的文本看起来像变灰了。TextView,文本灰显

我想这样设置文本的颜色,因为当你点击textView然后它看起来在黑色,因为它启用。

回答

4

对于改变的TextView的文本颜色,你需要设置其textColor属性。

在XML文件中,你可以这样做:

<TextView 
      android:text="Some text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="#ffff00" 
      android:background="#ff0000" 
      /> 

通过编程可以使用设置TEXTCOLOR及其在TextView的背景:

text_view.setBackgroundColor(Color.RED); 
    text_view.setTextColor(Color.BLUE); 

希望这有助于。 !

0

试试这个代码

text.setBackgroundColor(56565); 
    text.setEnabled(true); 

它将有助于ü