Following the question: Animate the background color of a view on Android I'm trying to make a TextView disappear between two backgrounds through a TransitionDrawable resource. My transition XML file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/gray_bar" />
<item android:drawable="@drawable/green_bar" />
</transition>
And I'm trying to set it as background at runtime:
TextView answerBox = (TextView) findViewById(R.id.answerBox);
answerBox.setBackgroundResource(R.drawable.correct_transition);
TransitionDrawable transition = (TransitionDrawable) answerBox.getBackground();
transition.startTransition(1500);
As a result, the text is converted from this:
to that:

When the whole gray bar needs to be converted to green.
Both are 9-patch png images. These are the originals:


, , , , . ? , , , , . , 9--, , .
!