cnfw
cnfw

Reputation: 800

How to place an image on top of another image in Android XML?

I am creating an app which is a guide. I have a photograph showing an example, but I need to know, how can I make certain parts of the images clickable, to go to another activity to show more details about that thing.

Or have an image (which will be clicked) on top of the base image?

Thanks

Upvotes: 0

Views: 390

Answers (2)

Vit Khudenko
Vit Khudenko

Reputation: 28418

You can split your main image on rectangular parts, then put them as ImageViews using RelativeLayout or TableLayout (which ever fits best in your case) so their combinations looks like a single image.

On each ImageView you can set a click listener using View.setOnClickListener(View.OnClickListener l)

Upvotes: 0

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

have an image (which will be clicked) on top of the base image?

1 - Can set the Background of Linear layout and add imageView in center of parent.

or

2- Use relative layout with tow image Views

Upvotes: 2

Related Questions