简体   繁体   English

android 谷歌地图将相机动画缓慢地移动到我的位置

[英]android google maps animate the camera slowly to my location

I need to move the camera to my location slowly in android, i use the code below but the camera change from position to another like switching between pages.我需要在 android 中缓慢地将相机移动到我的位置,我使用下面的代码,但相机从一个位置更改为另一个位置,例如在页面之间切换。 this is my code这是我的代码

                 CameraPosition cameraPosition = new CameraPosition.Builder()
                            .target(location1)
                            .zoom(16)
                            .bearing(90)
                            .tilt(30)
                            .build();
                    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 10000, null);

                    CameraUpdate center=
                            CameraUpdateFactory.newLatLng(location1);
                 //   CameraUpdate zoomcam=CameraUpdateFactory.zoomTo(zoom);

                    googleMap.moveCamera(center);

Just remove googleMap.moveCamera(center);只需删除googleMap.moveCamera(center); . . Use only googleMap.animateCamera(center);只使用googleMap.animateCamera(center); . .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM