3
private
Context context =
null
;
4
//
这是弹出窗口,
包括内容部分还有下面那个小三角
5
private
LinearLayout popupLinear =
null
;
6
//这是弹出窗口的内容部分
7
private
View popupView =
null
;
8
private
MapView mapView =
null
;
9
private
Projection projection =
null
;
10
11
//这是弹出窗口内容部分使用的 layoutId,在 Activity 中设置
12
private
int
layoutId = 0;
13
//
是否使用百度带有
A-J 字样的 Marker
14
private
boolean
useDefaultMarker =
false
;
15
private
int
[] defaultMarkerIds = { R.drawable.icon_marka,
16
R.drawable.icon_markb, R.drawable.icon_markc,
17
R.drawable.icon_markd, R.drawable.icon_marke,
18
R.drawable.icon_markf, R.drawable.icon_markg,
19
R.drawable.icon_markh, R.drawable.icon_marki,
20
R.drawable.icon_markj, };
21
22
//
这个
Listener 用于在 Marker 被点击时让 Activity 填充 PopupView 的内容
23
private
OnTapListener onTapListener =
null
;
24
25
public
MyPopupOverlay(Context context, Drawable marker, MapView mMapView) {
26
super
(marker, mMapView);
27
this
.context = context;
28
this
.popupLinear =
new
LinearLayout(context);
29
this
.mapView = mMapView;
30
popupLinear.setOrientation(LinearLayout.VERTICAL);
31
popupLinear.setVisibility(View.GONE);
32
projection = mapView.getProjection();
33
}
34
35
@Override
36
public
boolean
onTap(GeoPoint pt, MapView mMapView) {
37
//
点击窗口以外的区域时,当前窗口关闭
38
if
(popupLinear !=
null
&& popupLinear.getVisibility() == View.VISIBLE) {
39
LayoutParams lp = (LayoutParams) popupLinear.getLayoutParams();