简体   繁体   English

setTextAppearance()中的TextView,android-maps-utils 0.4.4始终是透明的

[英]TextView in setTextAppearance() android-maps-utils 0.4.4 always transparent

After bump from 0.4.3 to 0.4.4 in android-maps-utils I cannot set TextView style in IconGenerator for cluster icons. 在android-maps-utils中从0.4.3升到0.4.4后,我无法在IconGenerator中为集群图标设置TextView样式。 TextView stays transparent no matter what style I use (from lib or from my styles.xml). 无论我使用什么样式(从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);
}
}

Above works fine with 0.4.3. 以上工作正常,0.4.3。 But in 0.4.4 it doesn't work (even with changing to amu_ClusterIcon_TextAppearance). 但是在0.4.4中它不起作用(即使改为amu_ClusterIcon_TextAppearance)。

Code that can be blamed for this: https://github.com/googlemaps/android-maps-utils/commit/29490ad2cbc6bf2fb13fb7ac60eb8769c408bd51 but I don't see how it break visibility of TextView. 可以归咎于此的代码: https//github.com/googlemaps/android-maps-utils/commit/29490ad2cbc6bf2fb13fb7ac60eb8769c408bd51但我没看到它如何破坏TextView的可见性。

I solved as described here: https://github.com/googlemaps/android-maps-utils/issues/315 我解决了这里所描述的: https//github.com/googlemaps/android-maps-utils/issues/315

copy/paste of my answer here: After few digging the commit I noticed that also makeSquareTextView method changed. 复制/粘贴我的答案:在几次挖掘提交后,我注意到makeSquareTextView方法也发生了变化。 from

squareTextView.setId(R.id.text);

to

squareTextView.setId(R.id.amu_text);

this make the style change be able to show text label as desired 这使得样式更改能够根据需要显示文本标签

from

mIconGenerator.setTextAppearance(R.style.ClusterIcon_TextAppearance);

to

mIconGenerator.setTextAppearance(R.style.amu_ClusterIcon_TextAppearance);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM