[ACCEPTED]-Setting TextView color to a <selector> programmatically-android-resources
I think you might need to add findViewById
or something 2 of that variety
Edit: the above is incorrect 1 as per my comment the proper answer is
setTextColor(getResources().getColorStateList(R.color.redeemlist_item_color));
You have to use getColorStateList()
I was also struggling with 4 this problem, if you want to have use a 3 state list
, you need to declare it in the color
resources 2 folder, instead of the drawable
folder, and use 1 the setTextColor(getResources().getColorStateList(R.color.redeemlist_item_color))
.
You can try:
holder.label.setTextColor(getResources().getColor(R.color.redeemlist_item_color));
instead 1 of :
holder.label.setTextColor(R.color.redeemlist_item_color);
Rasman is correct. You need to give the 4 TextView an ID, android:id="@+/something". You 3 retrieve a reference to that particular 2 using that ID and findViewById, and then 1 you may set the text color.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.