在Google Maps API v2中是否可以设置自定义颜色的标记?我有一个白色的可绘制资源,想要对其应用颜色过滤器。我尝试了以下代码:
String color = db.getCategoryColor(e.getCategoryId());
Drawable mDrawable = this.getResources().getDrawable(R.drawable.event_location);
mDrawable.setColorFilter(Color.parseColor(Model.parseColor(color)),Mode.SRC_ATOP);
map.addMarker(new MarkerOptions().position(eventLocation)
.title(e.getName()).snippet(e.getLocation())
.icon(BitmapDescriptorFactory.fromBitmap(((BitmapDrawable) mDrawable).getBitmap())));
但是它不起作用。它只显示白色标记而没有自定义颜色。我传递给setColorFilter()的"color"字符串的值是"#RRGGBB"格式。