c# - 当itemsource是图像时如何修复xamarin表单listview滞后
问题描述
当 itemsource 是图像时如何修复 xamarin 表单列表视图滞后。图像来自文件夹路径我使用 FFimageloading 进行图像显示
<ffimageloading:CachedImage Aspect="AspectFill"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
BitmapOptimizations="True"
DownsampleToViewSize="True"
DownsampleUseDipUnits="True"
CacheDuration="80"
CacheType="Memory"
LoadingPlaceholder="ic_timer"
ErrorPlaceholder="ic_spare_active"
Source="{Binding DocumentUrl}">
<ffimageloading:CachedImage.Triggers>
<DataTrigger Binding="{Binding IsAddDocumentItem}"
TargetType="ffimageloading:CachedImage"
Value="True">
<Setter Property="IsVisible" Value="False"/>
</DataTrigger>
</ffimageloading:CachedImage.Triggers>
</ffimageloading:CachedImage>
解决方案
如果启用下采样,请确保为 DownsampleWidth 或 DownsampleHeight 设置正确的值。FFImageLoading 仅使用其中一种,保持正确的纵横比。
添加和CachingStrategy="RecycleElement"
到 ListView
在这里查看更多样品
推荐阅读
- pascalscript - 我的字符串数组的 Pascal InsertsionSort 无法正常工作
- angular - 如果 kendo-ui 默认使用英语表达但我在我的应用程序中使用另一种语言,我如何生成翻译文件?
- javascript - 无法将表单数据发送到 PHP 页面
- python-3.x - Elasticsearch 7:无法解析日期
- c# - Parallel.For 启动了意外数量的线程
- javascript - 推送订阅已取消订阅或过期,状态码为 410
- c++ - 在 CortexM0 中从 RAM 运行代码时出现硬故障
- android - 我可以将我的应用程序 sharedprefs 数据限制为 android 中的谷歌驱动器/云吗?
- javascript - 无法在带有 flex 的 slick-slider 项目中居中 div
- python - 为什么 python round(np.float16(np.pi),5) 返回无穷大?错误、限制或预期?