android - clickable area of image -
i'am designing gui remote control, instead of making separate buttons each remote button, want full ready remote image , set parts of click-able. there way rather motion event this?
i have 2 solutions requirement.in both,the whole image stays clickable can information clicked area.
solution 1:
you can mask image , pixel color of underneath image.so can come know area has been clicked.
here,whenever clicked occurs,you can check pixel color of background image
, match predefined color set know area has been clicked.
foreground image:
background image:
clickable area:
still confused?
reference: suggest go through this tutorial.
solution 2:
you can map image co-ordinates , accordingly can information of area has been clicked.
example: mappedimage co-ordinates
if not aware of co-ordinates,you can create mappedimage here
co-ordinates kansas this,
<area shape="poly" coords="243,162,318,162,325,172,325,196,244,196" id="@+id/area14" name = "kansas"/>
reference: please have @ android image mapping.
i hope helpful !!
Comments
Post a Comment