从Google地图Android中删除最后一条多段线? [英] Remove the last polyline line from Google Map Android?
本文介绍了从Google地图Android中删除最后一条多段线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个类选择
纬度
和经度
from sqlite
然后在地图上标记,然后绘制 polyLine
。
<每次我
选择
我的记录100到100,当我看到前100个,然后我清除地图,然后我得到第二个100,但是当我开始动画时,它显示我最后多段线
我如何可以清除最后一条多段线? 我的代码:
public class PathActivity_F扩展AppCompatActivity实现的OnMapReadyCallback {
私有GoogleMap mMap;
Query_DB QDB;
私人列表<标记> markers = new ArrayList<>();
private final Handler mHandler = new Handler();
ImageView imgBack,imgClear,imgStop,imgPath,imgToggle,imgForward;
布尔标志=真;
int loadLimit = 0;
int ival = 0;
布尔值ff = true;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_path);
SupportMapFragment mapFragment =(SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.mapPath);
mapFragment.getMapAsync(this);
imgBack =(ImageView)findViewById(R.id.imgBack);
imgClear =(ImageView)findViewById(R.id.imgClear);
imgStop =(ImageView)findViewById(R.id.imgStop);
imgPath =(ImageView)findViewById(R.id.imgPath);
imgToggle =(ImageView)findViewById(R.id.imgToggle);
imgForward =(ImageView)findViewById(R.id.imgForward);
Button btnFill =(Button)findViewById(R.id.btnFill);
Button btnStop =(Button)findViewById(R.id.btnStop);
Button btnClear =(Button)findViewById(R.id.btnClear);
Button btnToggle =(Button)findViewById(R.id.btnToggle); * /
QDB = new Query_DB(PathActivity_F.this);
imgBack.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
addLocations();
}
});
imgForward.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
});
imgPath.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
animator.startAnimation(true);
}
});
imgStop.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
animator.stopAnimation();
}
});
imgClear.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
clearMarkers();
}
});
imgToggle.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
toggleStyle();
}
});
$ b public void toggleStyle(){
if(GoogleMap.MAP_TYPE_NORMAL == mMap.getMapType()){
mMap.setMapType(GoogleMap .MAP_TYPE_SATELLITE);
} else {
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
}
/ **
*清除地图中的所有标记。
* /
public void clearMarkers(){
mMap.clear();
markers.clear();
}
private void addLocations(){
List< Marketing_Points_B> listPath = new ArrayList<>();
listPath.clear();
markers.clear();
字符串查询;
if(flag){
query =按时间ASC LIMIT 100从ReportAct_tbl组中按LatLng顺序选择时间,Lat,Lng;;
flag = false;
} else {
loadLimit = ival + 100;
ival = loadLimit;
query =从时间ASC LIMIT 100 OFFSET按LatLng顺序从ReportAct_tbl组中选择时间,Lat,Lng+ loadLimit +;;
}
Cursor cursor = QDB.db()。rawQuery(query,null);
cursor.moveToFirst();
尝试{
if(cursor!= null){
if(cursor.moveToFirst()){
do {
Marketing_Points_B MP = new Marketing_Points_B();
Double lat = cursor.getDouble(cursor.getColumnIndex(Lat));
Double lng = cursor.getDouble(cursor.getColumnIndex(Lng));
String Time = cursor.getString(cursor.getColumnIndex(Time));
MP.setLat(lat);
MP.setLng(lng);
MP.setTime(Time);
listPath.add(MP);
} while(cursor.moveToNext());
$ b} catch(Exception ex){
} finally {
cursor.close();
QDB.db()。close();
}
for(int i = 0; i< listPath.size(); i ++){
Double lat = listPath.get(i).getLat();
Double lng = listPath.get(i).getLng();
addMarkerToMap(new LatLng(lat,lng));
}
}
@Override
public void onMapReady(GoogleMap googleMap){
mMap = googleMap;
//在悉尼添加标记并移动相机
LatLng sydney = new LatLng(34.637727,50.877688);
mMap.addMarker(new MarkerOptions()。position(sydney).title(OK)。icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_red)));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
私人动画师动画师=新动画师();
int currentPt;
GoogleMap.CancelableCallback MyCancelableCallback =
new GoogleMap.CancelableCallback(){
@Override
public void onCancel(){
System。 out.println(onCancelled called);
@Override
public void onFinish(){
if(++ currentPt< markers.size()) {
float targetBearing = bearingBetweenLatLngs(mMap.getCameraPosition()。target,markers.get(currentPt).getPosition());
LatLng targetLatLng = markers.get(currentPt).getPosition();
Log.i(currentPt,currentPt =+ currentPt);
Log.i(size,size =+ markers.size());
//创建一个新的CameraPosition
CameraPosition cameraPosition =
新的CameraPosition.Builder()
.target(targetLatLng)
.tilt(currentPt< markers.size( ) - 1?90:0)
.bearing(targetBearing)
.zoom(mMap.getCameraPosition()。zoom)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
3000,
MyCancelableCallback);
System.out.println(Animate to:+ markers.get(currentPt).getPosition()+\\\
+
方位:+ targetBearing);
markers.get(currentPt).showInfoWindow();
} else {
}
}
};
私人浮动轴承之间LaLLngs(LatLng开始,LatLng结束){
位置beginL = convertLatLngToLocation(开始);
位置endL = convertLatLngToLocation(end);
return beginL.bearingTo(endL);
私人位置convertLatLngToLocation(LatLng latLng){
Location loc = new Location(someLoc);
loc.setLatitude(latLng.latitude);
loc.setLongitude(latLng.longitude);
返回loc;
}
public class Animator实现Runnable {
private static final int ANIMATE_SPEEED = 100;
private static final int ANIMATE_SPEEED_TURN = 1000;
private static final int BEARING_OFFSET = 20;
private final Interpolator interpolator = new LinearInterpolator();
int currentIndex = 0;
浮动倾斜= 90;
float zoom = 15.5f;
boolean upward = true;
long start = SystemClock.uptimeMillis();
LatLng endLatLng = null;
LatLng beginLatLng = null;
布尔showPolyline = false;
私人标记跟踪标记;
public void reset(){
resetMarkers();
start = SystemClock.uptimeMillis();
currentIndex = 0;
endLatLng = getEndLatLng();
beginLatLng = getBeginLatLng();
public void stop(){
trackingMarker.remove();
mHandler.removeCallbacks(animator);
$ b public void initialize(boolean showPolyLine){
reset();
this.showPolyline = showPolyLine;
highLightMarker(0);
if(showPolyLine){
polyLine = initializePolyLine();
}
//我们首先需要将相机放在第一次运行的正确位置(我们需要2个标记).....
LatLng markerPos = markers.get(0).getPosition();
LatLng secondPos = markers.get(1).getPosition();
setupCameraPositionForMovement(markerPos,secondPos);
}
private void setupCameraPositionForMovement(LatLng markerPos,
LatLng secondPos){
float bearing = bearingBetweenLatLngs(markerPos,secondPos);
trackingMarker = mMap.addMarker(new MarkerOptions()。position(markerPos)
.title(title)
.snippet(snippet)。icon(BitmapDescriptorFactory。 fromResource(R.drawable.map_marker_red)));
CameraPosition cameraPosition =
CameraPosition.Builder()
.target(markerPos)
.bearing(bearing + BEARING_OFFSET)
.tilt(90)
.zoom(mMap.getCameraPosition()。zoom> = 16?mMap.getCameraPosition()。zoom:16)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
ANIMATE_SPEEED_TURN,
new GoogleMap.CancelableCallback(){
@Override
public void onFinish(){
System.out.println(finished camera);
animator.reset();
Handler handler = new Handler();
$ handler.post(animator);
}
@Override
public void onCancel(){
System.out.println(cancelling camera);
}
}
);
}
私人Polyline polyLine;
private PolylineOptions rectOptions = new PolylineOptions();
private Polyline initializePolyLine(){
// polyLinePoints = new ArrayList< LatLng>();
rectOptions.add(markers.get(0).getPosition());
return mMap.addPolyline(rectOptions);
}
/ **
*将标记添加到折线中。
* /
private void updatePolyLine(LatLng latLng){
List< LatLng> points = polyLine.getPoints();
points.add(latLng);
polyLine.setPoints(points);
}
public void stopAnimation(){
animator.stop();
}
public void startAnimation(boolean showPolyLine){
if(markers.size()> 2){
animator.initialize(showPolyLine);
$ b @Override
public void run(){
经过的时间= SystemClock.uptimeMillis() - 开始;
double t = interpolator.getInterpolation((float)elapsed / ANIMATE_SPEEED);
double lat = t * endLatLng.latitude +(1 - t)* beginLatLng.latitude;
double lng = t * endLatLng.longitude +(1 - t)* beginLatLng.longitude;
LatLng newPosition = new LatLng(lat,lng);
trackingMarker.setPosition(newPosition);
if(showPolyline){
updatePolyLine(newPosition);
}
//无法通过摄影机位置更新移动标记+居中,而另一个摄影位置已经发生。
// navigateToPoint(newPosition,tilt,bearing,currentZoom,false);
// navigateToPoint(newPosition,false);
if(t <1){
mHandler.postDelayed(this,16);
} else {
System.out.println(Move to next marker .... current =+ currentIndex +and size =+ markers.size());
//想象5个元素 - 0 | 1 | 2 | 3 | 4 currentindex必须小于4
if(currentIndex< markers.size() - 2){
currentIndex ++;
endLatLng = getEndLatLng();
beginLatLng = getBeginLatLng();
start = SystemClock.uptimeMillis();
LatLng begin = getBeginLatLng();
LatLng end = getEndLatLng();
float bearingL = bearingBetweenLatLngs(begin,end);
highLightMarker(currentIndex);
CameraPosition cameraPosition =
新CameraPosition.Builder()
.target(end)//改变了这个...
.bearing(bearingL + BEARING_OFFSET)
.tilt(tilt)
.zoom(mMap.getCameraPosition()。zoom)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
ANIMATE_SPEEED_TURN,
null
);
start = SystemClock.uptimeMillis();
mHandler.postDelayed(动画师,16);
} else {
currentIndex ++;
highLightMarker(currentIndex);
stopAnimation();
$ b private LatLng getEndLatLng(){
return markers.get(currentIndex + 1) .getPosition();
}
private LatLng getBeginLatLng(){
return markers.get(currentIndex).getPosition();
$ b $ private void adjustCameraPosition(){
if(upward){
if(tilt <90){
tilt ++;
zoom - = 0.01f;
} else {
upward = false;
}
} else {
if(tilt> 0){
tilt--;
zoom + = 0.01f;
} else {
upward = true;
}
}
}
}
/ **
*在地图上添加一个标记。
* /
public void addMarkerToMap(LatLng latLng){
Marker marker = mMap.addMarker(new MarkerOptions()。position(latLng)
.title( title))
.snippet(snippet)。icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_red)));
markers.add(marker);
$ b private void resetMarkers(){
for(Marker marker:this.markers){
marker.setIcon(BitmapDescriptorFactory.fromResource(R .drawable.map_marker_green));
}
}
/ **
*按索引突出显示标记。
* /
private void highLightMarker(int index){
highLightMarker(markers.get(index));
}
/ **
*按标记突出显示标记。
* /
private void highLightMarker(Marker marker){
marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_yellow));
marker.showInfoWindow();
$ b
解决方案
解决我的问题,我评论了这一行:
// rectOptions.add(markers.get(0).getPosition ());
I created a class that select
latitudes
and longitude
from sqlite
then mark on map then draw polyLine
.
Problem :
Every time I select
my records 100 to 100, when I saw first 100 then I clear map then I get second 100 but when I start animate it show me last polyline
how I can clear last polyline ?
My code :
public class PathActivity_F extends AppCompatActivity implements OnMapReadyCallback {
private GoogleMap mMap;
Query_DB QDB;
private List<Marker> markers = new ArrayList<>();
private final Handler mHandler = new Handler();
ImageView imgBack, imgClear, imgStop, imgPath, imgToggle, imgForward;
boolean flag = true;
int loadLimit = 0;
int ival = 0;
boolean ff = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_path);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.mapPath);
mapFragment.getMapAsync(this);
imgBack = (ImageView) findViewById(R.id.imgBack);
imgClear = (ImageView) findViewById(R.id.imgClear);
imgStop = (ImageView) findViewById(R.id.imgStop);
imgPath = (ImageView) findViewById(R.id.imgPath);
imgToggle = (ImageView) findViewById(R.id.imgToggle);
imgForward = (ImageView) findViewById(R.id.imgForward);
Button btnFill = (Button) findViewById(R.id.btnFill);
Button btnStop = (Button) findViewById(R.id.btnStop);
Button btnClear = (Button) findViewById(R.id.btnClear);
Button btnToggle = (Button) findViewById(R.id.btnToggle);*/
QDB = new Query_DB(PathActivity_F.this);
imgBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addLocations();
}
});
imgForward.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
imgPath.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animator.startAnimation(true);
}
});
imgStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animator.stopAnimation();
}
});
imgClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clearMarkers();
}
});
imgToggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleStyle();
}
});
}
public void toggleStyle() {
if (GoogleMap.MAP_TYPE_NORMAL == mMap.getMapType()) {
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
} else {
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
}
/**
* Clears all markers from the map.
*/
public void clearMarkers() {
mMap.clear();
markers.clear();
}
private void addLocations() {
List<Marketing_Points_B> listPath = new ArrayList<>();
listPath.clear();
markers.clear();
String query;
if (flag) {
query = "select Time,Lat,Lng from ReportAct_tbl group by LatLng order by Time ASC LIMIT 100; ";
flag = false;
} else {
loadLimit = ival + 100;
ival = loadLimit;
query = "select Time,Lat,Lng from ReportAct_tbl group by LatLng order by Time ASC LIMIT 100 OFFSET " + loadLimit + ";";
}
Cursor cursor = QDB.db().rawQuery(query, null);
cursor.moveToFirst();
try {
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
Marketing_Points_B MP = new Marketing_Points_B();
Double lat = cursor.getDouble(cursor.getColumnIndex("Lat"));
Double lng = cursor.getDouble(cursor.getColumnIndex("Lng"));
String Time = cursor.getString(cursor.getColumnIndex("Time"));
MP.setLat(lat);
MP.setLng(lng);
MP.setTime(Time);
listPath.add(MP);
} while (cursor.moveToNext());
}
}
} catch (Exception ex) {
} finally {
cursor.close();
QDB.db().close();
}
for (int i = 0; i < listPath.size(); i++) {
Double lat = listPath.get(i).getLat();
Double lng = listPath.get(i).getLng();
addMarkerToMap(new LatLng(lat, lng));
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(34.637727, 50.877688);
mMap.addMarker(new MarkerOptions().position(sydney).title("OK").icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_red)));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
private Animator animator = new Animator();
int currentPt;
GoogleMap.CancelableCallback MyCancelableCallback =
new GoogleMap.CancelableCallback() {
@Override
public void onCancel() {
System.out.println("onCancelled called");
}
@Override
public void onFinish() {
if (++currentPt < markers.size()) {
float targetBearing = bearingBetweenLatLngs(mMap.getCameraPosition().target, markers.get(currentPt).getPosition());
LatLng targetLatLng = markers.get(currentPt).getPosition();
Log.i("currentPt", "currentPt = " + currentPt);
Log.i("size", "size = " + markers.size());
//Create a new CameraPosition
CameraPosition cameraPosition =
new CameraPosition.Builder()
.target(targetLatLng)
.tilt(currentPt < markers.size() - 1 ? 90 : 0)
.bearing(targetBearing)
.zoom(mMap.getCameraPosition().zoom)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
3000,
MyCancelableCallback);
System.out.println("Animate to: " + markers.get(currentPt).getPosition() + "\n" +
"Bearing: " + targetBearing);
markers.get(currentPt).showInfoWindow();
} else {
}
}
};
private float bearingBetweenLatLngs(LatLng begin, LatLng end) {
Location beginL = convertLatLngToLocation(begin);
Location endL = convertLatLngToLocation(end);
return beginL.bearingTo(endL);
}
private Location convertLatLngToLocation(LatLng latLng) {
Location loc = new Location("someLoc");
loc.setLatitude(latLng.latitude);
loc.setLongitude(latLng.longitude);
return loc;
}
public class Animator implements Runnable {
private static final int ANIMATE_SPEEED = 100;
private static final int ANIMATE_SPEEED_TURN = 1000;
private static final int BEARING_OFFSET = 20;
private final Interpolator interpolator = new LinearInterpolator();
int currentIndex = 0;
float tilt = 90;
float zoom = 15.5f;
boolean upward = true;
long start = SystemClock.uptimeMillis();
LatLng endLatLng = null;
LatLng beginLatLng = null;
boolean showPolyline = false;
private Marker trackingMarker;
public void reset() {
resetMarkers();
start = SystemClock.uptimeMillis();
currentIndex = 0;
endLatLng = getEndLatLng();
beginLatLng = getBeginLatLng();
}
public void stop() {
trackingMarker.remove();
mHandler.removeCallbacks(animator);
}
public void initialize(boolean showPolyLine) {
reset();
this.showPolyline = showPolyLine;
highLightMarker(0);
if (showPolyLine) {
polyLine = initializePolyLine();
}
// We first need to put the camera in the correct position for the first run (we need 2 markers for this).....
LatLng markerPos = markers.get(0).getPosition();
LatLng secondPos = markers.get(1).getPosition();
setupCameraPositionForMovement(markerPos, secondPos);
}
private void setupCameraPositionForMovement(LatLng markerPos,
LatLng secondPos) {
float bearing = bearingBetweenLatLngs(markerPos, secondPos);
trackingMarker = mMap.addMarker(new MarkerOptions().position(markerPos)
.title("title")
.snippet("snippet").icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_red)));
CameraPosition cameraPosition =
new CameraPosition.Builder()
.target(markerPos)
.bearing(bearing + BEARING_OFFSET)
.tilt(90)
.zoom(mMap.getCameraPosition().zoom >= 16 ? mMap.getCameraPosition().zoom : 16)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
ANIMATE_SPEEED_TURN,
new GoogleMap.CancelableCallback() {
@Override
public void onFinish() {
System.out.println("finished camera");
animator.reset();
Handler handler = new Handler();
handler.post(animator);
}
@Override
public void onCancel() {
System.out.println("cancelling camera");
}
}
);
}
private Polyline polyLine;
private PolylineOptions rectOptions = new PolylineOptions();
private Polyline initializePolyLine() {
//polyLinePoints = new ArrayList<LatLng>();
rectOptions.add(markers.get(0).getPosition());
return mMap.addPolyline(rectOptions);
}
/**
* Add the marker to the polyline.
*/
private void updatePolyLine(LatLng latLng) {
List<LatLng> points = polyLine.getPoints();
points.add(latLng);
polyLine.setPoints(points);
}
public void stopAnimation() {
animator.stop();
}
public void startAnimation(boolean showPolyLine) {
if (markers.size() > 2) {
animator.initialize(showPolyLine);
}
}
@Override
public void run() {
long elapsed = SystemClock.uptimeMillis() - start;
double t = interpolator.getInterpolation((float) elapsed / ANIMATE_SPEEED);
double lat = t * endLatLng.latitude + (1 - t) * beginLatLng.latitude;
double lng = t * endLatLng.longitude + (1 - t) * beginLatLng.longitude;
LatLng newPosition = new LatLng(lat, lng);
trackingMarker.setPosition(newPosition);
if (showPolyline) {
updatePolyLine(newPosition);
}
// It's not possible to move the marker + center it through a cameraposition update while another camerapostioning was already happening.
//navigateToPoint(newPosition,tilt,bearing,currentZoom,false);
//navigateToPoint(newPosition,false);
if (t < 1) {
mHandler.postDelayed(this, 16);
} else {
System.out.println("Move to next marker.... current = " + currentIndex + " and size = " + markers.size());
// imagine 5 elements - 0|1|2|3|4 currentindex must be smaller than 4
if (currentIndex < markers.size() - 2) {
currentIndex++;
endLatLng = getEndLatLng();
beginLatLng = getBeginLatLng();
start = SystemClock.uptimeMillis();
LatLng begin = getBeginLatLng();
LatLng end = getEndLatLng();
float bearingL = bearingBetweenLatLngs(begin, end);
highLightMarker(currentIndex);
CameraPosition cameraPosition =
new CameraPosition.Builder()
.target(end) // changed this...
.bearing(bearingL + BEARING_OFFSET)
.tilt(tilt)
.zoom(mMap.getCameraPosition().zoom)
.build();
mMap.animateCamera(
CameraUpdateFactory.newCameraPosition(cameraPosition),
ANIMATE_SPEEED_TURN,
null
);
start = SystemClock.uptimeMillis();
mHandler.postDelayed(animator, 16);
} else {
currentIndex++;
highLightMarker(currentIndex);
stopAnimation();
}
}
}
private LatLng getEndLatLng() {
return markers.get(currentIndex + 1).getPosition();
}
private LatLng getBeginLatLng() {
return markers.get(currentIndex).getPosition();
}
private void adjustCameraPosition() {
if (upward) {
if (tilt < 90) {
tilt++;
zoom -= 0.01f;
} else {
upward = false;
}
} else {
if (tilt > 0) {
tilt--;
zoom += 0.01f;
} else {
upward = true;
}
}
}
}
/**
* Adds a marker to the map.
*/
public void addMarkerToMap(LatLng latLng) {
Marker marker = mMap.addMarker(new MarkerOptions().position(latLng)
.title("title")
.snippet("snippet").icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_red)));
markers.add(marker);
}
private void resetMarkers() {
for (Marker marker : this.markers) {
marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_green));
}
}
/**
* Highlight the marker by index.
*/
private void highLightMarker(int index) {
highLightMarker(markers.get(index));
}
/**
* Highlight the marker by marker.
*/
private void highLightMarker(Marker marker) {
marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker_yellow));
marker.showInfoWindow();
}
}
解决方案
Resolve my problem, I commented this line:
//rectOptions.add(markers.get(0).getPosition());
这篇关于从Google地图Android中删除最后一条多段线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文