Changing Image In an ImageButton After Being Clicked?

Posted by BuZzZzJaY on Stack Overflow See other posts from Stack Overflow or by BuZzZzJaY
Published on 2010-04-14T04:50:35Z Indexed on 2010/04/14 4:53 UTC
Read the original article Hit count: 271

Filed under:
|
|

Creating a game in Android using multiple ImageButtons to display an image from the drawable folder and I want to change the button to a different image after the button has been clicked on. Here is the code for my image button:

 <ImageButton 
android:id="@+id/b56"
 android:layout_width="45px"
 android:layout_height="45px"
 android:layout_gravity="center_vertical"
 android:src="@drawable/black" 
 /> 

I can't find anything about how to change the actual image of the button. You can change the color of the button by using the following code in the java file:

b32.setBackgroundColor(0xAA00AA00);

© Stack Overflow or respective owner

Related posts about android

Related posts about imagebutton