android change image button background -


i cannot seem change background image of image button. heres code i'm trying use:

imagebutton imgbutton = (imagebutton) findviewbyid(r.id.showsportsbutton); imgbutton.setbackgroundresource(r.drawable.tab2_selected); 

however seem placing new image on top of old image leaving me 2 images overlapping each other.

does know why is??

for solving question should implement

imgbutton.setimageresource(r.drawable. tab2_selected); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -