1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public void draw(android.graphics.Canvas canvas, MapView mapView,
boolean shadow) {
super.draw(canvas, mapView, shadow);
if (shadow == false) {
// cycle through all overlays
for (int index = 0; index < mOverlays.size(); index++) {
OverlayItem item = mOverlays.get(index);
// Converts lat/lng-Point to coordinates on the screen
GeoPoint point = item.getPoint();
Point ptScreenCoord = new Point();
mapView.getProjection().toPixels(point, ptScreenCoord);
// Paint
Paint paint = new Paint();
paint.setTextAlign(Paint.Align.CENTER);
paint.setTypeface(Typeface.SERIF);
paint.setTextSize(mTextSize);
paint.setFakeBoldText(true);
paint.setARGB(150, 0, 0, 0); // alpha, r, g, b (Black, semi
// see-through)
// show text to the right of the icon
canvas.drawText(item.getTitle(), ptScreenCoord.x,
ptScreenCoord.y + mTextSize, paint);
}
}
} |
Partager