I wanted to draw a marker on Google map based on some location data I collected. When I tested the code using Galaxy S5 it draws the marker but when I try to do the same thing using a Motorola it fails to draw the marker at times and draws it other times. The object the marker represents is always there even in the Motorola. The Galaxy runs Android 5.1.1 and the Motorola 5.1: the code is as follows.
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;
}
There is similar question in SO but there is no answer regarding the hardware differences and how to deal with these issues. Can someone help?
EDIT---> The Galaxy has Google play services 9.2.56 and the Motorola has 9.4.52
答案 0 :(得分:1)
添加.visible(true)修复它在摩托罗拉手机中。我将测试其他设备并根据需要更新此答案。
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);