I have 2 solutions for your requirement.in both,the whole image stays clickable but you can get information about clicked area.
Solution 1:
you can mask the image and get the pixel color of that underneath image.so ultimately you can come to know which area has been clicked.
here,whenever clicked occurs,you can check the pixel color of background image
and match it with predefined color set to know about which area has been clicked.
Foreground image:
Background image:
Clickable area:
Still confused?
Reference:
I would like to suggest you to go through this tutorial.
Solution 2:
you can map your image with co-ordinates and accordingly you can get the information of area which has been clicked.
Example:
MappedImage with co-ordinates
if you are not aware of co-ordinates,you can create your mappedimage from here
co-ordinates for Kansas will look something like this,
<area shape="poly" coords="243,162,318,162,325,172,325,196,244,196" id="@+id/area14" name = "Kansas"/>
Reference:
Please have a look at Android Image Mapping.
I hope it will be helpful !!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…