我的 API 正在返回一个 SVG,我想把这个 SVG 变成一个位图,所以我可以将它用作我的谷歌地图片段上的 Pin。
我发现 https://github.com/japgolly/svg-android 将 Jar 添加到我的应用程序后,我开始收到与字体相关的奇怪运行时错误。显然它已经过时了,没有任何用处。
我研究了 Glide,因为有些人认为它可以与 SVG 一起使用。
我什至没有数据类型来读取它,而且真的没有办法将它转换为可用的格式。
我想做的就是把这个 responseBody.byteStream() 变成一个位图。也就是说,Java 解决方案也必须存在。
public Observable<Bitmap> fetchBitmap(String url) {
Observable<Bitmap> bitmapObservable = mGenericApiService.getBitmap(url)
.map(responseBody -> {
Bitmap.Config conf = Bitmap.Config.ARGB_8888;
Bitmap bitmap = Bitmap.createBitmap(50, 50, conf);
//******** CODE HERE?? ********
return bitmap;
}).doOnError(getUniversalErrorHandler(mContext, mEventBus));
return bitmapObservable;
}