CAA
CAA

Reputation: 970

Highlighting an area on a mapview

Google Maps itself can sort of Highlight areas, when you are searching for example for a city. http://2.bp.blogspot.com/-H_1aAsFOGks/TxhQNCgz8II/AAAAAAABD_I/Xent-NpuVjM/s640/google-maps-highlight.png

Since i haven´t found very much via the search function and google....

Is there an intended way to highlight an area (circle or rectangle) on an android mapview Or do i have to go the long way of calculating the necessary size of an picture (for example circle) (which is depending on the zoomlevel) and place it as a mapoverlay, which has to be replaced, whenever the zoom-level changes?

Upvotes: 0

Views: 951

Answers (1)

MahdeTo
MahdeTo

Reputation: 11184

Extend Overlay and override the draw method.

For example:

class HighlightedAreaOverlay extends Overlay {
    public void draw(Canvas canvas, MapView mapv, boolean shadow){
       super.draw(canvas, mapv, shadow);
       // your drawing code here
    }
}

Then add it to your mapView by calling mapView.getOverlays().add(new HighlightedAreaOverlay());

Upvotes: 3

Related Questions