10

Google開発者のWebサイトと同じように、ポリラインオプションを追加しています。

PolylineOptions rectOptions = new PolylineOptions()
        .add(new LatLng(37.35, -122.0))
        .add(new LatLng(37.45, -122.0))  // North of the previous point, but at the same longitude
        .add(new LatLng(37.45, -122.2))  // Same latitude, and 30km to the west
        .add(new LatLng(37.35, -122.2))  // Same longitude, and 16km to the south
        .add(new LatLng(37.35, -122.0)); // Closes the polyline.

// Get back the mutable Polyline
Polyline polyline = myMap.addPolyline(rectOptions);

削除したいです。しかし、 Google Maps Android API v2、マップからポリラインを削除する方法でrectOptions.remove() 述べたように、SDK から Google Play サービスを更新したことはありません。 しかし、まだ私はそれを持っていません。SDKマネージャーから更新しただけで、さらに何かをする必要がありますか? 私は本当にそれを削除する必要があり、メモリを節約するために非表示にしないでください。これは、多くのポイントのパスを何度も表示するためです。

4

2 に答える 2

11

を削除するにはPolyline、使用しますpolyline.remove();

于 2013-03-01T10:51:37.880 に答える
2

を使用PolylineOptionsして削除しないでください。

PolyLineこのように使用します

polyline.remove();

ドキュメンテーション

public void remove ()

Removes this polyline from the map. After a polyline has been removed, the behavior of all its methods is undefined.

于 2013-03-01T10:53:01.083 に答える