【问题标题】:How to draw at the current GPS location on MapView using MyLocationOverlay?如何使用 MyLocationOverlay 在 MapView 上绘制当前 GPS 位置?
【发布时间】:2011-01-07 11:24:55
【问题描述】:

我正在尝试绘制一个自定义 gps 位置图标。我正在使用MapView 并创建了一个扩展MyLocationOverlay 的类MyLocationArrow

我覆盖 drawMyLocation() 并在 100,100 处画一个点。但这是屏幕上的坐标。如何从当前 GPS 位置获取屏幕坐标?

【问题讨论】:

    标签: android gps location android-mapview mylocationoverlay


    【解决方案1】:

    你可以使用

    android.graphics.Point toPixels(GeoPoint in,
                                    android.graphics.Point out)
    

    将给定的GeoPoint 转换为屏幕像素坐标,相对于提供此ProjectionMapView 的左上角。

    .

    【讨论】:

    • 对不起,它在 MapView 中:mapView.getProjection().toPixels(in, out);
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 2012-09-03
    • 1970-01-01
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多