简体   繁体   中英

Android textColor won't change colour

I have tried...

android:textColor="#ff0000"

&

TextView app_nameTextView = (TextView) findViewById(R.id.app_name); app_nameTextView.setTextColor(getResources().getColor(R.color.white));

but it won't change the text colour, is there something I'm doing wrong?

尝试这个

 tv.setTextColor(Color.WHITE);

尝试android:textColor="#FFFFFF"白色的十六进制代码是#FFFFFF

What about Spannables? For example:

Spannable spanText = new SpannableString("INFO: Some spanned result.");
spanText.setSpan(new ForegroundColorSpan(Color.GREEN), 0, spanText.length(), 0); 

area.append(spanText);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM