Android Google Map - display line above markers -
according polyline documentation;
https://developers.google.com/android/reference/com/google/android/gms/maps/model/polyline
polylines can have z-index affects height relative other shapes, not markers. markers displayed @ higher level shapes. line display above markers on map, have ditch polyline entirely, , put canvas on framelayout , handle drawing of line myself? or there simpler way?
for else trying this, made class extending framelayout , implementing view.ontouchlistener. here's key part:
@override public void ondraw(canvas canvas) { path path = null; (point point : points) { if(path == null){ path = new path(); path.moveto(point.x, point.y); } else { path.lineto(point.x,point.y); } } if(path != null) { canvas.drawpath(path, paint); } } @override public boolean ontouch(view view, motionevent event) { if(event.getaction() == motionevent.action_up){ callback.complete(points,null); return true; } point point = new point(); point.x = event.getx(); point.y = event.gety(); points.add(point); invalidate(); //log.d(tag, "point: " + point); return true; } ontouch captures touch events, , invalidate() triggers ondraw draws line. add 1 of these layout (i did in java) , can draw on top of map's markers.
Comments
Post a Comment