任何人都知道为什么我的折线在我移动时没有画线?地图显示并且位置箭头正在跟踪,但没有画线。我认为这就是不断制作线路所需的全部内容:
PolylineOptions rectOptions = new PolylineOptions()
.add(new LatLng(location.getLatitude(), location.getLongitude()));
rectOptions.color(Color.RED);
mMap.addPolyline(rectOptions);
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
LocationManager locationmanager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationmanager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
if (v.getId() == R.id.button1) {setIt = true;};
if (v.getId() == R.id.button2) { mMap.clear();};
if (v.getId() == R.id.buttonPauseIt) { setIt = false;};
if (v.getId() == R.id.buttonResume) { setIt = true;};
}
@Override
public void onLocationChanged(Location location) {
PolylineOptions rectOptions = new PolylineOptions()
.add(new LatLng(location.getLatitude(), location.getLongitude()));
rectOptions.color(Color.RED);
if (setIt == true){
mMap.addPolyline(rectOptions);}
}