Change Offset

suggest change

Adjust the screen point's x and y before converting it back to a LatLng. By default the location sits at the center of the map view. Call this method wherever the center should move, for example from onLocationChanged: changeOffsetCenter(location.getLatitude(), location.getLongitude());

public void changeOffsetCenter(double latitude, double longitude) {
    Point mappoint = mGoogleMap.getProjection().toScreenLocation(new LatLng(latitude, longitude));
    // Move the target up by 100 px so the location sits below the center.
    // Scale this offset from DisplayMetrics if it should track screen size.
    mappoint.set(mappoint.x, mappoint.y - 100);
    mGoogleMap.animateCamera(CameraUpdateFactory.newLatLng(
            mGoogleMap.getProjection().fromScreenLocation(mappoint)));
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents