1

I am creating a MCQ application in which there are four option Buttons.Initially all the buttons's color is default color.Whenever user clicks on correct answer background color of the Button changes to green and when user clicks on wrong option Background color of the Button changes to red and display correct answer Button in green. After that user clicks on next question button. Now I want to change the background color of all the optionButtons to its initial state i.e default color. I don't know how to do it. Please help me in changing the Button image to its default color/image.

Nishant
  • 32,082
  • 5
  • 39
  • 53

1 Answers1

0

Inside the onClick() of the NEXT BUTTON place a the code to change the option button colors to the colors of your choice.

 onClick()
{
 button.setBackgroundColor(color);
}

The default color is not a color, it is StateListDrawable of many 9-patch images I suggest you set the background of buttons to be white for option buttons and then set it back to white when NEXT button is pressed.

jaisonDavis
  • 1,407
  • 2
  • 22
  • 36