0

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.

sam dev
  • 21
  • 4

1 Answers1

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