【发布时间】:2016-08-19 08:25:44
【问题描述】:
我正在尝试将标记的颜色设置为colorAccent,但不知何故它不适用于此代码:
Drawable drawable = getResources().getDrawable(R.drawable.ic_place_white_24dp);
drawable.setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.MULTIPLY);
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromBitmap(((BitmapDrawable) drawable).getBitmap());
Bitmap workingBitmap = Bitmap.createBitmap(((BitmapDrawable) drawable).getBitmap());
Bitmap mutableBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(mutableBitmap);
drawable.draw(canvas);
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(mutableBitmap);
markerOptions.icon(bitmapDescriptor);
我尝试将可绘制图标从纯白色图标切换为黑色图标,并尝试从Mode.MULTIPLY 切换为Mode.ADD。两者都没有成功。
【问题讨论】:
标签: android google-maps google-maps-markers android-canvas google-maps-android-api-2