0

With this question I somwhat understood how to draw a polygon in Android, but is there any way to make this click(touch)able?

Requirements:

I'm going to have multiple polygons in one view: each polygon must have it's own unique ontouchevent.

I need a lot of the functionality of a polygon, so they can't be replaced by images.

Community
  • 1
  • 1
anonymos
  • 167
  • 2
  • 14

1 Answers1

0

if this polygon has solid color, you can:

  1. assign a bitmap to the custom view canvas.
  2. implement ontouch in the custom view
  3. register the x,y user touched in the ontouch method
  4. get the pixel color in [x,y] from the custom view bitmap.
  5. check if the color of the pixel that was clicked is the color of the polygon.
chipopo
  • 326
  • 2
  • 9
  • clever workaround; yes it shall have a solid color, but no; because there's going to be multible polygons with the same color. Thanks Anyway! – anonymos Feb 19 '15 at 12:14
  • several polygon on the same custom view or each polygon could be its own custom view? – chipopo Feb 19 '15 at 12:40