如何为我的位置在谷歌地图Android版中移动变化圈 [英] how to move circle as my location changed in Google map in android
本文介绍了如何为我的位置在谷歌地图Android版中移动变化圈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发这个Android应用程序我画在地图上的一个圆
I am developing an android application in this i draw a circle on map
我想,作为我的位置发生改变,也圆作为移动我的位置变
I want that as my location changed circle also moves as my location changed
如果有任何人知道,请帮助我
在此先感谢
if any one know please help me thanks in advance
推荐答案
试试这个..
@Override
public void onLocationChanged(Location location)
{
drawMarker(location);
}
private void drawMarker(Location location)
{
googleMap.clear();
LatLng currentPosition = new LatLng(location.getLatitude(),location.getLongitude());
googleMap.addMarker(new MarkerOptions()
.position(currentPosition)
.snippet("Lat:" + location.getLatitude() + " Lng:"+ location.getLongitude())
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
.title("ME"));
double latitude = location.getLatitude();
double longitude = location.getLongitude();
CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(latitude,longitude)).zoom(15f).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
这篇关于如何为我的位置在谷歌地图Android版中移动变化圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文