为什么在Android中放大或缩小时不显示群集标记图标? [英] Why cluster marker icon not showing when zoom in or zoom out in android
本文介绍了为什么在Android中放大或缩小时不显示群集标记图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的地图上实现一个集群标记,首先,它显示集群标记,但是当我放大时,展开并显示白色方块,我将添加一些图像以更好地解释它。 / p>
public class MyItem implements ClusterItem {
private final LatLng mPosition;
String Title =;
int Icon;
$ b public MyItem(double lat,double lng,String title,int icon){
mPosition = new LatLng(lat,lng);
Title = title;
Icon =图标;
}
@Override
public LatLng getPosition(){
return mPosition;
}
public String getTitle(){
return Title;
}
public int getIcon(){
return Icon;
}
}
class OwnIconRendered extends DefaultClusterRenderer< MyItem> {
public OwnIconRendered(){
super(MapActivity.this,googleMap,mClusterManager);
@Override
protected void onBeforeClusterItemRendered(MyItem item,MarkerOptions markerOptions){
markerOptions.icon(BitmapDescriptorFactory.fromResource(item.getIcon( )));
markerOptions.title(item.getTitle());
super.onBeforeClusterItemRendered(item,markerOptions);
$ b @Override
保护无效onBeforeClusterRendered(集群< MyItem>集群,MarkerOptions markerOptions){
super.onBeforeClusterRendered(集群,markerOptions);
}
}
解决方案
gmaps-api-issues存在一个未解决的问题,请看这里: https://code.google.com/p/gmaps-api-issues/issues/detail?id=9765
另请看这里:谷歌地图标记被替换为在缩放时绑定矩形
还介绍了一些解决方法。
I'm trying to implement a cluster marker on my map,first, it shows me the cluster marker but when i zoom in, that expand and also show white square, i'll add some images to explain it better.
public class MyItem implements ClusterItem {
private final LatLng mPosition;
String Title = "";
int Icon;
public MyItem(double lat, double lng, String title, int icon) {
mPosition = new LatLng(lat, lng);
Title = title;
Icon = icon;
}
@Override
public LatLng getPosition() {
return mPosition;
}
public String getTitle() {
return Title;
}
public int getIcon() {
return Icon;
}
}
class OwnIconRendered extends DefaultClusterRenderer<MyItem> {
public OwnIconRendered() {
super(MapActivity.this, googleMap, mClusterManager);
}
@Override
protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {
markerOptions.icon(BitmapDescriptorFactory.fromResource(item.getIcon()));
markerOptions.title(item.getTitle());
super.onBeforeClusterItemRendered(item, markerOptions);
}
@Override
protected void onBeforeClusterRendered(Cluster<MyItem> cluster, MarkerOptions markerOptions) {
super.onBeforeClusterRendered(cluster, markerOptions);
}
}
解决方案
There is an opened issue on gmaps-api-issues, look here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=9765
Also look here: Google map marker is replaced by bounding rectangle on zoom
Some workarounds are also described there.
这篇关于为什么在Android中放大或缩小时不显示群集标记图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文