Как установить TextColor с помощью setTextColor (ColorsStateList colors)

Мне нужно изменить цвет текста при изменении состояния (нажатие, фокус) ...

Как установить цвет текста для TextView с использованием ColorsStateList ?

редактировать, решено:

textView.setTextColor(new ColorStateList(
   new int [] [] {
      new int [] {android.R.attr.state_pressed},
      new int [] {android.R.attr.state_focused},
      new int [] {}
   },
   new int [] {
      Color.rgb (255, 128, 192),
      Color.rgb (100, 200, 192),
      Color.White
   }
));

решение 2

textView.setTextColor(getResources().getColorStateList(R.color.your_colors))

Изменить цвет фона TextView при нажатии

49
задан Rodrigo 9 August 2018 в 04:49
поделиться