由于百度的InfoWindow只能展示一个,marker却不受限制,因此换了一个思路,在网上搜集了许多资料,最终实验成功。
通过创建一个自定义的bitmap然后以marker的形式添加到地图上。
在xml中,只有一个地图控件,因为手边没有真机,就用模拟器进行测试的,地图是用的是TextureMapView使用默认的MapVIew会报错。
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.pistol.markerinfos.MainActivity"> <com.baidu.mapapi.map.TextureMapView android:id="@+id/bmapView" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" /> </RelativeLayout>activity内容如下图:
public class MainActivity extends AppCompatActivity { private TextureMapView bmapView; private BaiduMap mBaiduMap; private BitmapDescriptor mIconMarker; private Bitmap bitmap = null; private List<LatLng> latList = new