0
任何人都可以看到爲什麼我的多段線在移動時沒有畫線?地圖顯示並且位置箭頭正在跟蹤,但不繪製線。我認爲這一切都是需要不斷進行線軌道:Polyline沒有在Api v2上顯示android
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);}
}