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.
Asked
Active
Viewed 221 times
0
-
could you show some code where you are facing the problem? – akhil nair Feb 12 '21 at 14:02
-
1Does this answer your question? [Single TextView with multiple colored text](https://stackoverflow.com/questions/6094315/single-textview-with-multiple-colored-text) – SebastienRieu Feb 12 '21 at 14:09
1 Answers
1
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.

Kalai
- 503
- 1
- 3
- 12