Loukas Leonardos
Loukas Leonardos

Reputation: 19

Button only changes color after touching

i use

 buttonled1.getBackground().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);

in a function to change the color of a button. When i first call the function in onCreate() method it works just fine, and the button is created with the color i want.

But when i call in the activity the same function which changes the color of the button again, i have to touch the button to see the color changing.. somehow color changing happens when i want it, but to make it visible i have to touch the button.

Upvotes: 1

Views: 79

Answers (1)

Ron
Ron

Reputation: 24235

Should call buttonled1.invalidate() after setting colorfilter.

Upvotes: 1

Related Questions