• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor Text View Change Color

hello i have a text view and that text is winter is coming text view Color is green also i have a sound, and my sound to say "winter is coming" when sound is playing every word changes color with my sound example when my sound say winter , winters text color change to red


Java:
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Winter Is Coming"
    android:id="@+id/txt"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/time"
        android:text="..."/>
<Button
    android:id="@+id/btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Play"
    tools:layout_editor_absoluteX="147dp"
    tools:layout_editor_absoluteY="419dp" />




Button btn;
TextView txt;
MediaPlayer ply;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = findViewById(R.id.btn);
        txt = findViewById(R.id.txt);
btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {

        txt.setText("Winter is Coming".toString());
        final MediaPlayer mp = MediaPlayer.create(MainActivity.this, R.raw.winter);
        mp.start();
        txt.setTextColor(Color.parseColor("#76FF03"));

    }
});
        new CountDownTimer(4, 1) {
            @Override
            public void onTick(long l) {
                txt.setTextColor(Color.parseColor("#76FF03"));
            }

            @Override
            public void onFinish() {

            }
        };
    }}
 
You didn't really state a question, so I'm not sure what you want here; but if you're asking how to make it change color with every word, my first thought would be to make every word a separate audio file and play them in sequence, changing colors as you fire off each.
 
Back
Top Bottom