Problem mit textColor und Background

  • Habe eine mybutton.xml in drawable/

    Habe zusätzlich noch eine mybuttontc.xml in color/

    Code
    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
     	<item android:state_pressed="true"
           	android:color="#f49595" /> <!-- pressed -->
     	<item android:state_pressed="false"
     		   android:color="#000000" />
     	
    </selector>

    Beides wird auf einen Button angewendet:

    Java
    Button b1 = new Button(this);
    b1.setBackgroundResource(R.drawable.mybutton);
    b1.setTextColor(R.color.mybuttontc);

    Problem: Hintergrundfarbe (Bild) ändert sich zwar beim drücken, die Schriftfarbe bleibt jedoch gleich. und zwar die farbe, die eig. beim drücken erscheinen soll, also f49595.

    Edited 3 times, last by maxihofa (January 30, 2012 at 2:42 PM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!