xamarin forms image not showing image in listview by URL sometimes

纵饮孤独 提交于 2021-01-29 09:17:58

问题


I'm using xamarin forms V3.4.0.1029999

I have a listview that it contains Image control.

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.

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


回答1:


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.

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

Download it form Nuget

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>


来源:https://stackoverflow.com/questions/54647346/xamarin-forms-image-not-showing-image-in-listview-by-url-sometimes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!