I have a TextView
which changes color based on value given by a SeekBar
:
if ((inOne >= 70 && inOne <= 90) && (inTwo >= 40 && inTwo <= 60)) {
tvRes.setText("LOW");
tvRes.setBackgroundColor(Color.parseColor("#73539E"));
rlO.setBackgroundColor(Color.parseColor("#9973539E"));
}
if ((inOne >= 70 && inOne <= 90) && (inTwo >= 61 && inTwo <= 80)) {
tvRes.setText("IDEAL");
tvRes.setBackgroundColor(Color.parseColor("#679800"));
rlO.setBackgroundColor(Color.parseColor("#99679800"));
}
if ((inOne >= 70 && inOne <= 90) && (inTwo >= 81 && inTwo <= 90)) {
tvRes.setText("PRE-HIGH");
tvRes.setBackgroundColor(Color.parseColor("#967400"));
rlO.setBackgroundColor(Color.parseColor("#99967400"));
}
inOne
and inTwo
are SeekBar
values.
It works 100% without any issue. What I was looking to do, instead of just changing the color, I want it to animate fade from one color to the next. How can I achieve it?
I was looking at this example: SO Example wasn't too clear on it.