android - 在 google map api 上更改 Android Cluster 的吸引力
问题描述
我们可以改变一个集群的吸引力,从而吸引更多的标记吗?
我的代码:(我在地图片段中使用的一个简单的类扩展)
class MyClusterManagerRenderer(
context : Context,
map : GoogleMap,
mClusterManager: ClusterManager<ClusterItem>
) : DefaultClusterRenderer<ClusterItem>(context, map, mClusterManager) {
private val mContext = context
override fun onBeforeClusterItemRendered(item: ClusterItem?, markerOptions: MarkerOptions?) {
super.onBeforeClusterItemRendered(item, markerOptions)
val iconFactory = IconGenerator(mContext)
iconFactory.setColor(ContextCompat.getColor(mContext, R.color.color))
iconFactory.setTextAppearance(R.style.googleMarkerText)
markerOptions
?.icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(item!!.title)))
?.anchor(iconFactory.anchorU, iconFactory.anchorV)
}
override fun getColor(clusterSize: Int): Int { return ContextCompat.getColor(mContext, R.color.color) }
override fun getMinClusterSize(): Int { return 3 }
}
解决方案
推荐阅读
- c# - 在 iOS 渲染器中是否有必要检查对象是否是我认为的对象(在这种情况下是 UITabBarController?
- go - 如何等待一个恐慌的 goroutine?
- c# - C#:强制 TLS1.2 但 Https 服务器仍然给出常见算法错误
- excel - 在所有工作表上添加带有公式的新行
- python - 获取另一列中每个唯一值的列的最大值,分组到另一列
- c - C中指针的自由函数问题
- flutter - 在 Flutter 上获取容器的“y”位置
- r - 将图例和标签放入 dtwclust 图
- php - Nginx+php-fpm。静态网站 + WordPress
- javascript - 你如何将类映射到之前是 HTMLcollection 的数组