1


在我当前的 Xamarin.Forms 项目中,我使用 FFImageLoader 来呈现我的 SVG。问题是我想预加载我的图像以避免丑陋的“页面构建问题”,但我不明白如何实现它。

当前使用情况:

new SvgCachedImage {
    WidthRequest = 200,
    HeightRequest = 200,
    Source = new SvgImageSource(ImageSource.FromResource("Path.to.image.in.project.svg", 200, 200, true)
}

所以我想要做的是将 SvgImageSource 加载到缓存中,然后在需要时从那里“获取”它。
也许我只是盲目地在文档中找到解决方案......

谢谢你的帮助!

4

1 回答 1

1
    ImageService.Instance.LoadEmbeddedResource("Path.to.image.in.project.svg")
                .WithCustomDataResolver(new SvgDataResolver(200, 200, true))
                .Preload();
于 2018-03-23T11:24:39.770 回答