Android地图上添加图层并可监听图层点击事件
2012-07-04 17:49:16 来源:WEB开发网核心提示:实现图层单击监听的监听器:OnMarkItemClickListener onMarkItemClickListener = new OnMarkItemClickListener(){@Overridepublic void OnItemClick(Bundle bundle) { if(!isShow){ is
实现图层单击监听的监听器:
OnMarkItemClickListener onMarkItemClickListener = new OnMarkItemClickListener(){
@Override
public void OnItemClick(Bundle bundle) {
if(!isShow){
isShow = true;
new AlertDialog.Builder(Main.this)
.setTitle(bundle.getString("locationName")+"地址")
.setMessage(bundle.getString("locationAddress"))
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
dialog.dismiss();
}
})
.show();
}
}
};
@Override
public void OnItemClick(Bundle bundle) {
if(!isShow){
isShow = true;
new AlertDialog.Builder(Main.this)
.setTitle(bundle.getString("locationName")+"地址")
.setMessage(bundle.getString("locationAddress"))
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
dialog.dismiss();
}
})
.show();
}
}
};
代码很简答,贴上去根据个人需求简单修改就可以用了,实现出来的效果图如下:
点击上面的"7天连锁酒店梅林阁店"弹出一个对话框:
更多精彩
赞助商链接