有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Mapsforge图像覆盖安卓

如何将圆形覆盖改为图像

以下是我的代码MainActivity Extendes 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);
}

共 (0) 个答案