从XML形状透明的Andr​​oid BitMapDesc​​riptor是黑色的 [英] Android BitMapDescriptor from XML shape transparent is black

查看:156
本文介绍了从XML形状透明的Andr​​oid BitMapDesc​​riptor是黑色的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,对的GoogleMap(V2)在地面叠加使用时,这个bitmapdescriptor透明度被显示为黑色的任何人都可以解释,为什么?

So this bitmapdescriptor when used in a Groundoverlay on GoogleMap (v2) the transparency is being shown as black can anyone explain why?

半径圆形文件

   <?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>

地方地图

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)

推荐答案

嗯确定的答案似乎是设置结束颜色为透明硬,而不是依靠

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"

这篇关于从XML形状透明的Andr​​oid BitMapDesc​​riptor是黑色的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆