将标记与蓝色圆圈一起移动 [英] Move marker along with blue circle

查看:109
本文介绍了将标记与蓝色圆圈一起移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google地图上工作。我观察到蓝圈(显示运动)是准确的,但标记将保留在最后位置。



我已经在onLocationChanged()函数上添加了标记,但它仍然不改变标记的位置,而任何位置都会改变,但小蓝圈会发生变化。 b
$ b

对此有任何帮助??

解决方案

试试这个..

  @Override 
public void onLocationChanged(Location location){
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng latLng =新LatLng(经度,纬度);
if(myMarker == null){
myMarker = googleMap.addMarker(new MarkerOptions()。position(latLng).icon(
BitmapDescriptorFactory.fromBitmap(resize(R.drawable.my_marker) )));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));

} else {
myMarker.setPosition(latLng);
}
}
}


I am working on google map. I observed that the blue circle (which shows the movement) is accurate but the marker will remain at the last position.

I have added the marker onLocationChanged() function but still its not changing the position of the marker while any location changes but the small blue circle changes.

Any Help on this ??

解决方案

Try this..

@Override
    public void onLocationChanged(Location location) {
        double latitude = location.getLatitude();
        double longitude = location.getLongitude();
        LatLng latLng = new LatLng(latitude, longitude);
        if (myMarker == null) {
            myMarker = googleMap.addMarker(new MarkerOptions().position(latLng).icon(
                    BitmapDescriptorFactory.fromBitmap(resize(R.drawable.my_marker))));
            googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));

        } else {
            myMarker.setPosition(latLng);
        }
    }
}

这篇关于将标记与蓝色圆圈一起移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆