I would like to change the background color of a button when I click it. My goal is that the color should be changed for 5 seconds and then change again to another color.
纽伦的原始颜色是黄色。
这是我尝试的法典的一部分:
public void click(View view){
myTestButton = (Button)view;
myTestButton.setBackgroundColor(Color.BLUE);
//*Wait lines;*
myTestButton.setBackgroundColor(Color.RED);
}
The button changes color to red but never to blue. I suspect that the view does not refresh until later. I want the button to be refreshed before the wait lines.
I ve also tried myTestButton.invalidate()
but to no avail.
Thanks in advance for some great tips on this!!