浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。

文档全面上新

更科技的视觉体验,更高效的页面结构,快前往体验吧!

体验新版
定位图标样式自定义
功能场景
支持自定义图标样式,支持使用gif图和呼吸动效,提供丰富的自定义参数。
Android
//mapopen-website-wiki.bj.bcebos.com/demos/SVID_20230406_114021_1.mp4
1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/定位图标样式自定义.png
扫码体验
使用产品
下载源码
//mapopen-website-wiki.bj.bcebos.com/demos/%E5%AE%9A%E4%BD%8D%E5%9B%BE%E6%A0%87/BaiduMapsApiASDemo.zip
核心接口
接口
描述
备注
Builder(LocationMode locationMode,boolean enableArrow)
1.locationMode 定位图层显示方式, 默认为 LocationMode.NORMAL 普通态 2.enableArrow 定位图标是否需要带箭头
setArrow(BitmapDescriptor arrow)
设置用户自定义定位图标的箭头,可以为 null
setCustomMarker(BitmapDescriptor customMarker)
设置自定义的定位图标,可以为null
MyLocationConfiguration.Builder
setGifMarker(String )
设置gif格式的定位图标,gifPath为路径。
地图SDK
setAnimation(boolean isNeedAnimation)
设置定位图标是否可以做呼吸动画
setMarkerRotation(boolean isRotation)
设置定位图标是否可以旋转
示例代码
设置定位模式,并自定义定位图标
JAVA
MyLocationConfiguration.LocationMode mCurrentMode; = MyLocationConfiguration.LocationMode.NORMAL;

BitmapDescriptor arrow = BitmapDescriptorFactory.fromResource(R.drawable.icon_arrow);
String gifMarker = getCustomGIFFilePath(LocationTypeDemo.this, "people.gif");
MyLocationConfiguration myLocationConfiguration =
        new MyLocationConfiguration.Builder(mCurrentMode,true)
                .setArrow(arrow).setArrowSize(0.6f)
                .setGifMarker(gifMarker).setMarkerSize(2.2f)
                .setAnimation(true).setMarkerRotation(false)
                .build();
                
mBaiduMap.setMyLocationConfiguration(myLocationConfiguration);
复制
深色
复制成功
  • 文档根本没法用

  • 文档水平很差

  • 文档水平一般

  • 文档不错

  • 文档写的很好

如发现文档错误,或对此文档有更好的建议,请在下方反馈。问题咨询请前往反馈平台提交工单咨询。

提交反馈

拖动标注工具

添加矩形标注

添加箭头标注

完成

取消