最近需要实现地图的点聚合功能,由于刚开始项目中使用的是高德地图,查看Android高德地图的官方文档,发现没有这个功能,要自己实现了,下面把demo源码贴出来供大家参考!
先上图:
下面就来看看是如何实现的吧····
首先要按照高德地图的官方文档把高德地图集成进来(http://lbs.amap.com/api/android-sdk/summary/);
下面直接上代码:
布局文件代码:activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map"
class="com.amap.api.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://s