2

如何将我的圆圈叠加更改为图像?

这是我的代码 MainActivity 扩展了 Circle Overlay 的 MapActivity 代码:

ListOverlay listOverlay = new ListOverlay();
        List<OverlayItem> overlayItems = listOverlay.getOverlayItems();

        Cursor campgroundList = campgroundDB.getCampgrounds();
        if(campgroundList != null) {
            while(campgroundList.moveToNext()) {
                GeoPoint campgroundLocation = new  GeoPoint(campgroundList.getDouble(campgroundList.getColumnIndex("latitude")),campgroundList.getDouble(campgroundList.getColumnIndex("longitude")));
                //if(shouldShowCampground(campgroundLocation)) {
                    Circle circle = showCampground(campgroundLocation);
                    //overlayItems.setMarker(defaultMarker);
                    overlayItems.add(circle);
                //}
            }
        }
        mapView.getOverlays().add(listOverlay);

private static Circle showCampground(GeoPoint location) {
    Paint paintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    paintFill.setStyle(Paint.Style.FILL);
    paintFill.setColor(Color.MAGENTA);
    paintFill.setAlpha(64);

    Paint paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    paintStroke.setStyle(Paint.Style.STROKE);
    paintStroke.setColor(Color.MAGENTA);
    paintStroke.setAlpha(128);
    paintStroke.setStrokeWidth(3);

    return new Circle(location, 200, paintFill, paintStroke);
}
4

0 回答 0