我正在尝试在我的应用程序中添加Google地图。我的地图成功显示在我的应用程序中。
但是问题是我没有得到理想的职位。
static final LatLng vrrittihLocation = new LatLng(23.001779, 72.618946);
private GoogleMap googleMap;
if (googleMap == null) {
googleMap = ((SupportMapFragment) getFragmentManager()
.findFragmentById(R.id.map)).getMap();
}
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
MarkerOptions Mo = new MarkerOptions()
.position(vrrittihLocation)
.title("Vrrittih Global Recruitment Consulting")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_marker));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(vrrittihLocation, 18);
googleMap.animateCamera(cameraUpdate);
googleMap.addMarker(Mo);
我在这里想念什么吗?
标记应在您的地图上,原因是您看不到所需位置,因此您可以使用以下代码移动相机。
CameraPosition cameraPosition = new CameraPosition.Builder().target(vrrittihLocation)
.zoom(18)
.build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);
googleMap.animateCamera(cameraUpdate);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句