【问题标题】:if I give image path like foldername/picture name it display On windows platoform but not in Android in xamarin如果我给出像文件夹名称/图片名称这样的图像路径,它会显示在 Windows 平台上,但不会在 xamarin 中的 Android 中显示
【发布时间】:2020-01-12 04:57:06
【问题描述】:

BackgroundImage="图片/abc.jpg"

在内容页面中我添加了这个,但它没有在 UWP 项目的 android 显示中显示图像

【问题讨论】:

标签: android ios windows xamarin


【解决方案1】:

请将您的图片放入资源文件夹,如下图所示。

然后在 xamarin 表单中使用它。

在你的情况下,你可以把你的图片放到 Resource 中,然后像下面的代码那样设置它。

MyImage.Source = Device.RuntimePlatform == Device.Android ? ImageSource.FromFile("hk,jpg") : ImageSource.FromFile("Picture/abc.jpg");

【讨论】:

  • 这个问题有更新吗?如果回复有帮助,请将其标记为答案,它将帮助其他有类似问题的人。
猜你喜欢
  • 1970-01-01
  • 2015-12-19
  • 1970-01-01
  • 2016-06-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多