【发布时间】:2015-10-13 12:08:15
【问题描述】:
我创建了一个使用 google maps v2 的 android 应用程序。我正在尝试使用 GroundOverlay 将图像放置在我的地图上,但由于某种原因它无法正常工作。
根据我所做的研究和我在互联网上看到的其他示例,我已经以正确的方式将其写入我的应用程序,为什么我没有覆盖?
叠加选项位于 OnMapLongClick() 方法中,以便在用户将手指放在地图上时放置叠加。我还调用了一个 toastLong() 方法,以显示一个 toast 来检查 OnMapLongClick 方法是否正常工作。
叠加层的图像也肯定存在并且可以访问。
代码如下:
//-----map long click
@Override
public void onMapLongClick(LatLng point) {
toastMsg = "on map long click";
toastLong();
//add overlay
BitmapDescriptor image = BitmapDescriptorFactory.fromResource(R.drawable.lower_ui);
GroundOverlayOptions groundOverlay = new GroundOverlayOptions()
.image(image)
.position(point, 500f, 500f)
.transparency(1.0f);
mapView.addGroundOverlay(groundOverlay);
}
【问题讨论】:
标签: java android google-maps google-maps-android-api-2 android-mapview