This is a fact that I discovered later in my project: MapView is actually a ViewGroup ( also mentioned here ). Therefore, instead of using complex Overlay and attaching drawings, you can simply create a button (or text view, or a nested layout, or whatever you want to display above the map), assign it an instance of MapView.LayoutParams and add it to MapView .
In code:
// Create the overlay pin View overlayPin = getLayoutInflater().inflate(R.layout.overlay_pin, null); // Number it according to your question, eg ((TextView)(overlayPin.findViewById(R.id.overlay_text))).setText("1");
Suppose you want to put the output on geo-coordinates -60, 30.
That way, you can only have one graphic asset for the pin background and use the TextView for numbering.
yuku
source share