I need to insert two images and two buttons. The action required is that when I click on the first button, the corresponding image should be displayed. The same action is required for other button also, but the second image should be displayed.
Asked
Active
Viewed 2,016 times
-2
-
4Is it possible to expand your question to contain more detail??????? please – Andy E Jun 15 '10 at 07:49
3 Answers
2
I'm guessing you mean a button with an image on it?
For that, you'll need an ImageButton.

Dave
- 6,064
- 4
- 31
- 38
-
i need to insert 2 images and 2 buttons.action required is that whn i click on th first button corrsponding image should be displayed.same action required for other button also but second image shid be displayed. – antony joe Jun 15 '10 at 08:36
-
So you want the image to be displayed after button click or the image should be a button? – Ravi Vyas Jun 15 '10 at 09:10
-
there should always 2 buttons and an image.image switches according to the button – antony joe Jun 15 '10 at 09:35
0
Image button can be added as
<ImageButton android:layout_width="wrap_content" android:id="@+id/ImageButton01" android:layout_height="wrap_content" android:src="@drawable/icon">
</ImageButton>

amithgc
- 6,167
- 6
- 29
- 38
0
Assuming we finally understood what is required you need to have an onClick listener on both the buttons which when invoked will change the image you are displaying :-)

Ravi Vyas
- 12,212
- 6
- 31
- 47