3

在谷歌地圖上的屏幕中心放置標記android和uber和ola應用中的相同。當移動或滾動谷歌地圖標記不應該移動,它應該給latlng座標如何在谷歌地圖上的屏幕中心放置一個標記

+0

你到目前爲止嘗試過什麼? –

+0

看看http://stackoverflow.com/questions/36157242/pinch-to-zoom-google-map-with-out-moving-marker-in-framelayout/36287722#36287722 – antonio

回答

0

試試這個取位置,

CameraPosition cameraPosition = new CameraPosition.Builder() 
      .target(new LatLng(currentLatitude, currentLongitude)).zoom(15).build(); 

    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 
0
Check Out This 

    LatLng mapCoordinate = new LatLng(yourLatitude, yourLatitude); 
    CameraUpdate yourLocation = CameraUpdateFactory.newLatLngZoom(mapCoordinate, 11.0f); 
    yourMap.animateCamera(yourLocation); 

    Or In Other way 

    LatLng mapCoordinate = new LatLng(yourLatitude, yourLatitude); 
    CameraPosition cameraPosition = new CameraPosition.Builder() 
     .target(mapCoordinate) // set to Center 
     .zoom(12.0f)    // for the Zoom 
     .bearing(90)    // Orientation of the camera to east 
     .tilt(30)     // Tilt of the camera to 30 degrees 
     .build();     // Creates a CameraPosition 
    yourMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 
1

你需要把frameLayout.That的ImageView的中心是不是你的地圖標記,但它放置在中心,當你點擊該圖像視圖時,你需要獲得地圖的中心LatLng

這裏是獲取中心LatLn g地圖:

LatLng center = mgoogleMap.getCameraPosition()。target;

+0

我有一個你想要的演示。我可以與你分享。 –

相關問題