xamarin表单图像有时无法通过URL在列表视图中显示图像 [英] xamarin forms image not showing image in listview by URL sometimes

查看:31
本文介绍了xamarin表单图像有时无法通过URL在列表视图中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xamarin形式V3.4.0.1029999

I'm using xamarin forms V3.4.0.1029999

我有一个包含图像控件的列表视图.

I have a listview that it contains Image control.

我通过字符串Property传递图像源.有时listview不会按URL显示图像.我的意思是例如它显示39个项目,但2.

I Pass image source by an string Property. sometimes listview wont show image By URL. i mean for example it shows 39 items but 2.

有时它不会从URL加载图像.我应该怎么做才能始终加载图像?

Sometimes it wont load image from URL. what should i do to always load image?

推荐答案

我建议您使用 FFImageLoading的 CachedImage.

I would suggest you use FFImageLoading's CachedImage for this.

这是一个被社区广泛接受的库,它具有出色的缓存功能,并且还具有内存处理选项.

It is a library that is vastly accepted by the community and is great with caching and has memory handling options as well.

您可以查看其 Git Wiki 来深入了解该库.

You can check their Git wiki to understand the library in depth.

Nuget

在每个平台上调用 CachedImageRenderer.Init().让我们将其放在我们的Android项目的 MainActivity.cs 和iOS的 AppDelegate.cs 上.

Call CachedImageRenderer.Init() on each platform. Let’s put it on MainActivity.cs of our Android project and AppDelegate.cs of iOS.

然后添加其命名空间并像这样使用它:

Then add its namespace and use it like this:

  <ffimageloading:CachedImage
                HorizontalOptions="Center" VerticalOptions="Center"
                DownsampleToViewSize="true"
                Source = "{Binding ImageUrl}">
        </ffimageloading:CachedImage>

这篇关于xamarin表单图像有时无法通过URL在列表视图中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆