我要根据位置显示/隐藏标记。
LatLng LocDon = new LatLng(latitude_don, longitude_don);
Marker mk1 = mMap.addMarker(new MarkerOptions()
.position(LocDon)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
allMarkerMap.put(mk1, Don.class);
mMap.setOnInfoWindowClickListener(this);
mk1.setVisible(false);
if(r>=longitude_don&&_r<=longitude_don){
if(l>=latitude_don&&_l<=latitude_don){
don = don + 1;
if(don < 2) {
vibe.vibrate(200);
mk1.setVisible(true);
}
}
}
if(r<longitude_don||_r>longitude_don){
if(l<latitude_don||_l>latitude_don) {
mk1.setVisible(false);
vibe.vibrate(1000);
}
}
我把两种类型的振动检查进入if句子。
我可以得到两种vibration(200&1000)
,但我只能隐藏标记。
大多数回答这类问题(隐藏标记),人们说使用setVisible(false).
但为什么我无法得到它?有人帮帮我......请....
编辑。 添加日志。
03-27 21:58:06.719 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放610K,10%免费41281K / 45652K,暂停2ms + 4ms,总计39ms 03-27 21:58:11.624 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭 03-27 21:58:11.654 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭 03-27 21:58:11.694 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放330K,10%免费41286K / 45652K,暂停5ms + 5ms,总计40ms 03-27 21:58:16.809 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭 03-27 21:58:16.839 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭 03-27 21:58:16.889 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放141K,10%免费41332K / 45652K,暂停2ms + 4ms,总计47ms 03-27 21:58:21.733 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放165K,10%免费41340K / 45652K,暂停6ms + 6ms,总计63ms 03-27 21:58:25.677 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放160K,10%免费41387K / 45652K,暂停2ms + 3ms,总计75ms 03-27 21:58:30.672 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放198K,10%免费41408K / 45652K,暂停3ms + 3ms,总计45ms 03-27 21:58:36.608 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放146K,10%免费41452K / 45652K,暂停2ms + 5ms,总计37ms 03-27 21:58:46.558 30659-30659 / org.androidtown.realchangdeokgung I /输入:ON 03-27 21:58:46.608 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放832K,10%免费41492K / 45652K,暂停2ms + 5ms,总计41ms 03-27 21:58:46.648 30659-30659 / org.androidtown.realchangdeokgung I /输入:ON 03-27 21:58:56.637 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放381K,9%免费41759K / 45652K,暂停2ms + 3ms,总计37ms 03-27 21:58:58.870 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放157K,9%免费41803K / 45652K,暂停2ms + 5ms,总计35ms 03-27 21:59:03.684 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放261K,9%免费41696K / 45652K,暂停3ms + 6ms,总计47ms 03-27 21:59:07.628 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放141K,9%免费41742K / 45652K,暂停3ms + 6ms,总计63ms 03-27 21:59:09.680 30659-30666 / org.androidtown.realchangdeokgung I / dalvikvm:Jit:将JitTable从4096调整为8192 03-27 21:59:12.683 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放173K,9%免费41751K / 45652K,暂停6ms + 5ms,总计48ms 03-27 21:59:14.795 30659-30803 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放140K,9%免费41797K / 45652K,暂停7ms + 6ms,总计97ms 03-27 21:59:17.728 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放117K,9%免费41831K / 45652K,暂停2ms + 4ms,总计35ms 03-27 21:59:23.744 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放173K,9%免费41842K / 45652K,暂停2ms + 5ms,总计35ms 03-27 21:59:27.728 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放173K,9%免费41857K / 45652K,暂停3ms + 4ms,总计42ms 03-27 21:59:31.682 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放135K,9%免费41904K / 45652K,暂停5ms + 5ms,总计49ms 03-27 21:59:38.588 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭 03-27 21:59:38.699 30659-30659 / org.androidtown.realchangdeokgung D / dalvikvm:GC_EXPLICIT释放157K,9%免费41927K / 45652K,暂停5ms + 8ms,总计62ms 03-27 21:59:38.699 30659-30659 / org.androidtown.realchangdeokgung我/退出:关闭
答案 0 :(得分:0)
使用任何有用的
marker.remove();
或强>
googlemap.clear();