Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想根据前面的条件来绘制和移除Marker 必须是如何
例子:
int a ; if( a > 0 ) { draw Marker } if(a == 0) { remove Marker }
你几乎拥有它:
private Marker marker; // ... private void draw(int a) { if (a == 0) { if (marker != null) { marker.remove(); marker = null; } } else if (a > 0) { marker = mMap.addMarker(new MarkerOptions().position(new LatLng(40,-4))); } }