【问题标题】:Xamarin Failed loading bitmap in skiasharpXamarin 在skiasharp 中加载位图失败
【发布时间】:2019-11-25 15:47:55
【问题描述】:

我有问题。我正在尝试加载图像,所以我使用以下代码:

string resourceID = "MyApp.Templates.Good_Question.png";
Assembly assembly = GetType().GetTypeInfo().Assembly;

using (Stream stream = assembly.GetManifestResourceStream(resourceID))
{
    bitmap = SKBitmap.Decode(stream);
}

但它在流上给出错误,因为流为空。现在我在应用程序的根目录中创建了一个名为 Templates 的文件夹,并在该文件夹中放置了一个名为 Good_Question.png 的图像。

为什么我的流是空的?

【问题讨论】:

标签: c# xamarin xamarin.forms skiasharp


【解决方案1】:

我找到了,我必须将 Build Action 设置为 Embedded Resource,而不是 Resource

【讨论】:

    猜你喜欢
    • 2017-04-03
    • 2017-06-05
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 2018-11-02
    • 2020-02-04
    相关资源
    最近更新 更多