image - 来自 URL 的 Xamarin Forms 图像源被缓存?
问题描述
我的 FTP 服务器上有一些要显示的图像,我在 XAML 中的代码是:
<Image x:Name="sponsor1" Source="http://website.com/web/image1.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="CenterAndExpand"/>
我最近更改了 FTP 服务器上的图像,但我的应用程序(通过 USB 连接并且应用程序由 IDE 运行)仍在显示不再存在的旧图像。
为什么这样做?是缓存吗?如何禁用它?
解决方案
是的,默认情况下启用缓存。要禁用,请设置CachingEnabled="false"
<Image
HorizontalOptions="CenterAndExpand"
VerticalOptions ="CenterAndExpand">
<Image.Source>
<UriImageSource Uri="{Binding Image}"
CacheValidity="14"
CachingEnabled="true"/>
</Image.Source>
</Image>
推荐阅读
- java - 为什么将 Spring Cloud 应用程序与 AWS Parameter Store 集成不会从参数存储中返回任何属性?
- mysql - 根据 UserId 检索特定的 GroupId
- python-3.x - 如何在xlsx中为单元格的单词着色
- bash - 如何使用 hxselect 生成数组结果?
- spring - 在 TestRestTemplate 中解析 LocalDateTime 不起作用(错误请求)
- mysql - 通过 bash 脚本将多个 csv 文件加载到 MariaDB/MySQL
- php - 根据 Woocommerce 中的客户订单数显示不同的通知
- python-2.7 - 已经转换为 Unicode 的单词也被认为是新的用户输入,并被一次又一次地转换
- javascript - 如何在 d3 工具提示中添加点击事件?
- powerbi - Power BI - 在报表中使用默认值和指定值进行计算