【问题标题】:Xamarin Forms Image source from URL gets cached?来自 URL 的 Xamarin Forms 图像源被缓存?
【发布时间】:2019-08-07 22:59:52
【问题描述】:

我的 FTP 服务器上有一些图像要显示,我在 XAML 中的代码是:

 <Image x:Name="sponsor1" Source="http://website.com/web/image1.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="CenterAndExpand"/>

我最近更改了 FTP 服务器上的图像,但我的应用程序(通过 USB 连接并且应用程序由 IDE 运行)仍在显示不再存在的旧图像。

为什么要这样做?是缓存吗?如何禁用它?

【问题讨论】:

    标签: image caching xamarin.forms


    【解决方案1】:

    是的,caching 默认启用。要禁用,请设置CachingEnabled="false"

    <Image 
        HorizontalOptions="CenterAndExpand"
        VerticalOptions ="CenterAndExpand">
        <Image.Source>
            <UriImageSource Uri="{Binding Image}" 
                CacheValidity="14" 
                CachingEnabled="true"/>
        </Image.Source>
    </Image>
    

    【讨论】:

      猜你喜欢
      • 2017-08-23
      • 2018-01-28
      • 1970-01-01
      • 2019-03-18
      • 2020-04-13
      • 2019-02-12
      • 1970-01-01
      • 2020-06-27
      • 2020-06-22
      相关资源
      最近更新 更多