Possible Duplicate:
How to Change color of Button in Android when Clicked?
I want to change the color of button when it clicked…
How i can do it? I don’t want to do it by using drawable folder…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
use a
selector, create a file xml in yourdrawable/folder and name itbg_button.xml:and then in your xml layout , define your button like this :
NB :
back_button_clickedandback_button_normalaredrawablesfor the background of yourbutton.the drawable
back_button_clickedwill be the background of your button when it will be clicked , andback_button_normalwill be the background of your button in normal case.EDIT : here is a tutorial for more explanation . and here is another one