首页 > 解决方案 > Android - 将drawablebitmap的边框作为MapView中的标记

问题描述

我想为从base64字符串转换为图像的drawableBitMap制作边框或描边。有人可以帮我做到这一点吗?这是我的示例代码:

String base64String = facilitiesOverlayProperties.get(i).getImage();
                byte[] decodedString = Base64.decode(base64String, Base64.DEFAULT);
                Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
                BitmapDrawable bitmapDrawable  = new BitmapDrawable(map.getContext().getResources(), Bitmap.createScaledBitmap(decodedByte, 26, 26, false));
                    mapMarker.setIcon(bitmapDrawable);

创建边框或笔划的代码仍然不存在,因为我不知道该怎么做。

标签: javaandroidbase64borderandroid-drawable

解决方案


您可以使用以下方法在位图周围制作圆形边框:

//mMap is your GoogleMap Refrence

mMap.addCircle(new CircleOptions()
            .center(new LatLng(latitude, longitude)).radius(10)
            .strokeColor(0x220000FF)//stroke color
            .strokeWidth(5)
            .fillColor(0x220000FF));//your fill colour

推荐阅读