自定义标记未在某些设备上绘制
Custom marker is not drawn on some devices
我想根据我收集的一些位置数据在 Google 地图上画一个标记。当我使用 Galaxy S5 测试代码时,它会绘制标记,但当我尝试使用摩托罗拉做同样的事情时,它有时无法绘制标记,有时会绘制标记。标记所代表的对象即使在摩托罗拉中也始终存在。 Galaxy运行Android 5.1.1和摩托罗拉5.1:代码如下。
private MarkerOptions getMarkerForItem(Provider pro, LatLng lctionll, float brng){
MarkerOptions mo = new MarkerOptions();
isMarkerAlive = true;
mo.icon((BitmapDescriptorFactory.fromResource(R.drawable.cuteMarker)))
.anchor(0.5f, 0.5f) //so marker rotates around the center
.position(lctionll)
.rotation(brng)
.flat(true);
return mo;
}
有类似的question in SO,但没有关于硬件差异以及如何处理这些问题的答案。有人可以帮忙吗?
编辑---> Galaxy 有 Google 播放服务 9.2.56,摩托罗拉有 9.4.52
添加 .visible(true) 修复了它在摩托罗拉 phone 中的问题。我会测试其他设备并根据需要更新此答案。
MarkerOptions mo = new MarkerOptions().icon((BitmapDescriptorFactory.fromResource(R.drawable.movingcab)))
.anchor(0.5f, 0.5f) //so marker rotates around the center
.position(lctionll)
.rotation(brng)
.visible(true)
.flat(true);
我想根据我收集的一些位置数据在 Google 地图上画一个标记。当我使用 Galaxy S5 测试代码时,它会绘制标记,但当我尝试使用摩托罗拉做同样的事情时,它有时无法绘制标记,有时会绘制标记。标记所代表的对象即使在摩托罗拉中也始终存在。 Galaxy运行Android 5.1.1和摩托罗拉5.1:代码如下。
private MarkerOptions getMarkerForItem(Provider pro, LatLng lctionll, float brng){
MarkerOptions mo = new MarkerOptions();
isMarkerAlive = true;
mo.icon((BitmapDescriptorFactory.fromResource(R.drawable.cuteMarker)))
.anchor(0.5f, 0.5f) //so marker rotates around the center
.position(lctionll)
.rotation(brng)
.flat(true);
return mo;
}
有类似的question in SO,但没有关于硬件差异以及如何处理这些问题的答案。有人可以帮忙吗?
编辑---> Galaxy 有 Google 播放服务 9.2.56,摩托罗拉有 9.4.52
添加 .visible(true) 修复了它在摩托罗拉 phone 中的问题。我会测试其他设备并根据需要更新此答案。
MarkerOptions mo = new MarkerOptions().icon((BitmapDescriptorFactory.fromResource(R.drawable.movingcab)))
.anchor(0.5f, 0.5f) //so marker rotates around the center
.position(lctionll)
.rotation(brng)
.visible(true)
.flat(true);