问题
So this bitmapdescriptor when used in a Groundoverlay on GoogleMap (v2) the transparency is being shown as black can anyone explain why?
Radius Circle shape file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<gradient android:startColor="@color/brand_color" android:endColor="@android:color/transparent" android:type="radial" android:gradientRadius="110"/>
</shape>
place on Map
if (mDotMarkerBitmap==null){
int px = getResources().getDimensionPixelSize(R.dimen.pin_radius_drawable);
mDotMarkerBitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mDotMarkerBitmap);
Drawable shape = getResources().getDrawable(R.drawable.radius_circle);
shape.setBounds(0, 0, mDotMarkerBitmap.getWidth(), mDotMarkerBitmap.getHeight());
shape.draw(canvas);
}
BitmapDescriptor descriptor = BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap);
GroundOverlay groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
.image(descriptor)
.transparency(0.4F)
.position(center, radiusDistance.distanceInMeters*2));
I can't seem to understand why this is being malformed I just want it to fade out from inner to out, however it is fading from color to grey (black but transparent)
回答1:
Hmmm ok the answer seemed to be to set the end color to a hard transparency rather than relying on
android:endColor="@android:color/transparent"
I changed the end color to this
android:endColor="#00FFFFFF"
来源:https://stackoverflow.com/questions/19198447/android-bitmapdescriptor-from-xml-shape-transparent-is-black