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

Change Textcolor on Button pressed

Hello
I have a Button with a shape as drawable.
I would like change the textcolor of the button, on state_pressed.

How is it possible?

greets
Markus
 
You're gonna want to declare:
Code:
Button btnyourbutton = (Button)findViewById(R.id.btnyourbutton);
and also declare what color you want to set it to. Example:
Code:
int red = -65536;
Find the constant value of colors here:
Color | Android Developers

and then where you have your button press:
Code:
btnyourbutton.setTextColor(red)
 
Back
Top Bottom