Reputation: 21
In my application i need to set different colors for text view in recycler view adapter class, can anyone help me to solve this issue.
Upvotes: 0
Views: 270
Reputation: 543
In your onBindViewHolder
, obtain the text view via the respective ViewHolder and simply call setTextColor
on it with the appropriate color ( Ideally this could be based on the data at the specified position
from onBindViewHolder
).
If you want different colors within a single text view, you could follow the link to the answer provided by @SebastienRieu in the comments.
I think this codelab might be helpful for you.
Upvotes: 1