/* (non-Javadoc) * @see com.baidu.mapapi.ItemizedOverlay#setFocus(Item) */ @Override public void setFocus(Item item) { super.setFocus(item); currentFocusedIndex = getLastFocusedIndex(); currentFocusedItem = item; if (currentFocusedItem == null) { hideBalloon(); } else { createAndDisplayBalloonOverlay(); } }
public void draw(Canvas canvas, MapView mapView, boolean shadow) { // 投影,用于屏幕像素点坐标系统与地球经纬度点坐标系统的转换 Projection projection = mapView.getProjection(); for (int index = size() - 1; index >= 0; index--) { OverlayItem overlayItem = this.getItem(index); String title = overlayItem.getTitle(); Point point = projection.toPixels(overlayItem.getPoint(), null); Paint painttext = new Paint(); painttext.setColor(Color.BLACK); painttext.setTextSize(15); canvas.drawText(title, point.x - 30, point.y - 25, painttext); } super.draw(canvas, mapView, shadow); boundCenterBottom(marker); }
@Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); boundCenterBottom(marker); Projection projection = mapView.getProjection(); for (int index = size() - 1; index >= 0; index--) { OverlayItem overLayItem = getItem(index); @SuppressWarnings("unused") String title = overLayItem.getTitle(); Point point = projection.toPixels(overLayItem.getPoint(), null); // Hide Text /*Paint paintText = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.DEV_KERN_TEXT_FLAG); paintText.setTypeface(Typeface.DEFAULT_BOLD); paintText.setFakeBoldText(true); paintText.setColor(Color.BLACK); paintText.setTextSize(16f); canvas.drawText(title, point.x-15, point.y+18, paintText); */ // Draw number if (isShowNumber) { // Point markStartPoint = getMarkerStartPoint(point); Paint numberPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); numberPaint.setColor(Color.WHITE); numberPaint.setTypeface(Typeface.DEFAULT_BOLD); int number = index + 1; if (number / 10 == 0) { numberPaint.setTextSize(19f); canvas.drawText(String.valueOf(number), point.x - 5, point.y - 26, numberPaint); } else { numberPaint.setTextSize(17f); canvas.drawText(String.valueOf(number), point.x - 10, point.y - 26, numberPaint); } } } }