@Override
public boolean onTap(int index) {
//在此处理item点击事件
LayoutInflater inflater = LayoutInflater.from(mapView.getContext())
View view = inflater.inflate(R.layout.reserve_warning_pop, null)
TextView tv_reservewarning_pop_parkinglotname = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotname)
TextView tv_reservewarning_pop_parkinglotaddress = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotaddress)
TextView tv_reservewarning_pop_parkinglotcurrentstall = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotcurrentstall)
TextView tv_reservewarning_pop_parkinglotprice = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotprice)
if (parkingLot != null) {
//停车场名
//停车场地址
//停车场可预订车位
//停车场收费类型
}
//预定按钮
Button bt_reservewarning_pop_reserve = (Button) view.findViewById(R.id.bt_reservewarning_pop_reserve)
bt_reservewarning_pop_reserve.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//业务处理 }
}
}
})
//d出自定义界面
popupOverlay = new PopupOverlay(mapView, null)
OverlayItem overlayItem = getItem(index)
mapView.getController().setCenter(overlayItem.getPoint())
popupOverlay.showPopup(view, overlayItem.getPoint(), 5)
mapView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//隐藏d出窗口
popupOverlay.hidePop()
}
})
return super.onTap(index)
}
iOS-百度地图自定义气泡IOS百度地图自定义大头针和气泡
重点是定义了一个全局变量来取气泡的数据模型:
static int paopaoIndex = 0
此可以添加自定义气泡<script type="text/javascript">
// 百度地图API功能
var sContent =
"<h4 style='margin:0 0 5px 0padding:0.2em 0'>天安门</h4>" +
"<img style='float:rightmargin:4px' id='imgDemo' src='http://app.baidu.com/map/images/tiananmen.jpg' width='139' height='104' title='天安门'/>" +
"<p
style='margin:0line-height:1.5font-size:13pxtext-indent:2em'>天安门坐落
在中国北京市中心,故宫的南侧,与天安门广场隔长安街相望,是清朝皇城的大门...</p>" +
"</div>"
var map = new BMap.Map("allmap")
var point = new BMap.Point(116.404, 39.915)
var marker = new BMap.Marker(point)
var infoWindow = new BMap.InfoWindow(sContent) // 创建信息窗口对象
map.centerAndZoom(point, 15)
map.addOverlay(marker)
marker.addEventListener("click", function(){
this.openInfoWindow(infoWindow)
//图片加载完毕重绘infowindow
document.getElementById('imgDemo').onload = function (){
infoWindow.redraw() //防止在网速较慢,图片未加载时,生成的信息框高度比图片的总高度小,导致图片部分被隐藏
}
})
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)