【问题标题】:ListView ImageCells' images not showing in UWPListView ImageCells 的图像未在 UWP 中显示
【发布时间】:2017-11-22 05:02:29
【问题描述】:

我有一个带有 ListViewImageCells 的 Xamarin.Forms 应用程序。其中的图像在 Android 和 iOS 中可见,但在 UWP 中不可见。

相关代码:

imageCell.SetBinding(ImageCell.ImageSourceProperty, theImagePropertyName);

和属性:

return ImageSource.FromUri(uri);

uri 是正确的 uri(如断点所示),它是外部 uri https://blahblahblah.com,如前所述 - 它适用于 Android 和 iOS。我试过一个外部静态 uri,一个内部 (ms-appx:///Assets/a.png) uri...

可能是什么问题?

【问题讨论】:

  • 您是否将图像放在应用程序的根文件夹中?
  • @JesusAngulo 对不起,我不清楚 - uri 是外部的 (https://blahblahblah.com)。我现在编辑了这个问题以明确这一点。
  • 您是否在清单中设置了 Internet (InternetClient) 权限?
  • @JesusAngulo 我尝试使用静态图像。没有帮助。 (顺便说一句 - 您的链接是 404。)
  • @JesusAngulo 作为旁注:https://www.xamarin.com/content/images/pages/forms/example-app.png。工作中。不知何故,您似乎需要添加 www 否则会导致 404。

标签: c# xamarin uwp xamarin.forms xamarin.uwp


【解决方案1】:

我的 iOS 应用程序中发生了这种情况。我不知道为什么会这样。我能够解决它的唯一方法是使用FFimageLoading 或者我也能够创建我的旧延迟加载图像实现,但FFImageLoading 似乎要好一些。实现非常简单,您只需将数据类型从Xamarin.Forms.Image 替换为FFImageLoading.CachedImage(或者如果您处于平台级别类似的东西)。

抱歉,我无法告诉您“这就是为什么____”,我无法弄清楚为什么会发生这种情况。你有一个图像,你设置了来源,繁荣常识告诉你它应该加载。但是我在 iOS 上的 xamarin forms listview 上遇到了完全相同的问题(至少)。这是解决它的唯一方法。

我与 FFImageLoading 没有任何关系

【讨论】:

  • 谢谢。但我对 3rd 方库不感兴趣。
  • 好的,您能在找到解决方案后更新您的问题吗?我在 iOS 上也有类似的问题。
  • @jdmdevdotnet 你想分享你的解决方案吗?我无法在我的环境中重现它
  • 你实现了FFImageLoading吗?
猜你喜欢
  • 1970-01-01
  • 2016-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多