1

在 android-maps-utils 从 0.4.3 升级到 0.4.4 后,我无法在 IconGenerator 中为集群图标设置 TextView 样式。无论我使用什么样式(来自 lib 或来自我的 styles.xml),TextView 都保持透明。

public class MapRenderCustom extends DefaultClusterRenderer<T> {
public MapRenderCustom(Context context, GoogleMap map, ClusterManager<T> clusterManager) {
    super(context, map, clusterManager);
new IconGenerator(contex).setTextAppearance(com.google.maps.android.R.style.ClusterIcon_TextAppearance);
}
}

以上适用于 0.4.3。但在 0.4.4 中它不起作用(即使更改为 amu_ClusterIcon_TextAppearance)。

可以归咎于此的代码:https ://github.com/googlemaps/android-maps-utils/commit/29490ad2cbc6bf2fb13fb7ac60eb8769c408bd51但我看不出它如何破坏 TextView 的可见性。

4

1 回答 1

4

我按照这里的描述解决了: https ://github.com/googlemaps/android-maps-utils/issues/315

在此处复制/粘贴我的答案:经过几次挖掘提交后,我注意到 makeSquareTextView 方法也发生了变化。从

squareTextView.setId(R.id.text);

squareTextView.setId(R.id.amu_text);

这使得样式更改能够根据需要显示文本标签

mIconGenerator.setTextAppearance(R.style.ClusterIcon_TextAppearance);

mIconGenerator.setTextAppearance(R.style.amu_ClusterIcon_TextAppearance);

于 2016-09-27T15:17:48.663 回答