android - Xamarin 表单 |安卓 : BitmapDescriptor Error - Image must be a Bitmap

标签 android xamarin.android xamarin.forms

我正在尝试使用 GroundOverlayOptions 将自定义图像添加到我的 Android.gms.maps

BitmapDescriptor image = BitmapDescriptorFactory.FromPath("fire2.bmp");

GroundOverlayOptions newarkMap = new 
GroundOverlayOptions().InvokeImage(image);
newarkMap.Position(e.Point, 8600f, 6500f);
map.AddGroundOverlay(newarkMap);

尽管 fire2.bmp 是位图,但我仍然收到错误:

Java.Lang.IllegalArgumentException:解码图像失败。提供的图像必须是位图。

我错过了什么?

最佳答案

我建议使用 BitmapDescriptorFactory.FromResource。如果在编译时你没有得到任何错误,这意味着你的资源存在并且将在运行时找到

关于android - Xamarin 表单 |安卓 : BitmapDescriptor Error - Image must be a Bitmap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45365694/

相关文章:

android - 使用CheckBoxPreference切换手机的声音,振动和互联网访问的开/关

android - 找不到兼容的并排 NDK 版本 React Native

xaml - 如何在 Xamarin Forms 中超链接部分标签文本?

c# - 添加到 ObservableCollection - 对象引用错误

Android:提高应用搜索结果排名

c# - 如何调试突然终止而没有任何反馈的应用程序?

c# - 将整数发送到 Android 后台应用程序

android - RecyclerView OnClick 在其他位置更改项目

c# - 将 Xamarin Forms 中的 DateTime 格式化为设备格式字符串

android - 单击时如何将微调器放置在微调器布局下方并在 Lollipop 及上方显示微调器项目?