Google Maps Android V2 indentation with rotation around the user

I am developing an application using google map to display your location. I want to rotate the map around the location of users. I use getOrientation (R, orientation) (and set it to true north) to make the rotation of the device work fine, but I want the user's location to be at the bottom of the screen. I set the registration on the map to a quarter of the height of the screen.   mMap.setPadding(0,screenHeight/4,0,0); What I noticed is that the rotation is still performed around a point in the center of the screen NOT filled by the center. This is the code I use in onSensorChanged

 currentZoom = mMap.getCameraPosition().zoom;
 CameraPosition currentPlace = new CameraPosition.Builder()
                               .target(new LatLng(currentNode.getLatitude(), currentNode.getLongitude()))
                               .bearing(degrees).tilt(60).zoom(currentZoom).build();
mMap.stopAnimation();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(currentPlace),40,null);

Is there any way to change the pivot point of the camera rotation?

+4
source share
1 answer

I tried to solve this problem for several hours. The only solution I found is not very good, but it works: For example, if you want to move the 200dp user below the center:

1) Set the height of the map fragment to its height + 200 dp (then the map will be 200dp below the screen)

2) It works great, but it hides the Google logo. To save the Google logo, set the top and bottom margins of the map to 200dp.

mGoogleMap.setPadding(0, dp2px(200),0 , dp2px(200));

This solves the problem.

0
source

All Articles