java - 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);
创建边框或笔划的代码仍然不存在,因为我不知道该怎么做。
解决方案
您可以使用以下方法在位图周围制作圆形边框:
//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
推荐阅读
- ios - 计算 UILabel 的实际文本框
- swift - 如何在swift中从高度确定文本的字体大小?
- typescript - 如何将对象属性定义为函数 = 正确的语法?
- react-native-ios - 在 react-native 中,iphone X 中只覆盖了一半的通知栏
- json - 将文件保存到 Blob 存储
- javascript - Vue Native App中如何实现nativescript-loading-indicator
- r - 如何解构列表并将其作为 r 中的行添加到数据框中
- windows - 使用 powershell 访问远程计算机时出现审计错误
- javascript - 从电子应用程序运行 python 脚本时如何解决“错误:spawn py ENOENT”错误?
- decompiling - CAPL 反编译器从 cbf 到 can