高德地图android标记点文本,自定义点标记内容

自定义点标记

html, body, #container {

height: 100%;

width: 100%;

}

.custom-content-marker {

position: relative;

width: 25px;

height: 34px;

}

.custom-content-marker img {

width: 100%;

height: 100%;

}

.custom-content-marker .close-btn {

position: absolute;

top: -6px;

right: -8px;

width: 15px;

height: 15px;

font-size: 12px;

background: #ccc;

border-radius: 50%;

color: #fff;

text-align: center;

line-height: 15px;

box-shadow: -1px 1px 1px rgba(10, 10, 10, .2);

}

.custom-content-marker .close-btn:hover{

background: #666;

}

var position = new AMap.LngLat(116.397428, 39.90923);

// 创建地图实例

var map = new AMap.Map("container", {

zoom: 13,

center: position,

resizeEnable: true

});

// 点标记显示内容,HTML要素字符串

var markerContent = '' +

'

' +

' dir-via-marker.png' +

'

X
' +

'

';

var marker = new AMap.Marker({

position: position,

// 将 html 传给 content

content: markerContent,

// 以 icon 的 [center bottom] 为原点

offset: new AMap.Pixel(-13, -30)

});

// 将 markers 添加到地图

map.add(marker);

// 清除 marker

function clearMarker() {

map.remove(marker);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值