Ass*_*nov 9 android google-maps bitmap
BitmapDescriptor bmpD = BitmapDescriptorFactory.fromResource(R.raw.podval);
Log.d("myLog", ":" + bmpD);
GroundOverlayOptions newarkMap = new GroundOverlayOptions()
.image(bmpD)
.position(sydney, 8600f, 6500f);
Log.d("myLog", ":" + newarkMap);
GroundOverlay imageOverlay = mMap.addGroundOverlay(newarkMap);
Run Code Online (Sandbox Code Playgroud)
无法解码图像。提供的图像必须是位图。但在日志中我得到了:com.google.android.gms.maps.model.BitmapDescriptor@58e0ee6
:com.google.android.gms.maps.model.GroundOverlayOptions@1ea9c27
我也将jpg图像转换为bmp,在这里转换失败后
请帮忙。
Coo*_*ind 10
有关矢量绘图 (SVG),请参阅/sf/answers/3189549611/ 。
private BitmapDescriptor bitmapDescriptorFromVector(Context context, @DrawableRes int vectorResId) {
Drawable vectorDrawable = ContextCompat.getDrawable(context, vectorResId);
vectorDrawable.setBounds(0, 0, vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight());
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.draw(canvas);
return BitmapDescriptorFactory.fromBitmap(bitmap);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7695 次 |
| 最近记录: |