gpt4 book ai didi

c# - Lottie.Forms - 从 EmbeddedResources 加载

转载 作者:行者123 更新时间:2023-12-03 06:26:45 24 4
gpt4 key购买 nike

我有一个 AnimationView在 AirBnb 的 Lottie 中定义框架应该加载放置在我的 Xamarin.Forms 项目中的 Resource 文件夹中的文件(可移植的)

        <forms:AnimationView
x:Name="AnimationView"
Animation="SharpLibrary.Forms.Assets.Images.WineGlass.json"
Loop="True"
AutoPlay="True"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" />

但它似乎无法解析 Animation 中的字符串属性,所以它不会显示动画。如果我将文件放入 Resource 文件夹并说 Animation="WineGlass.json"有用。

有没有办法从 EmbeddedResource 加载它,或者这是不可能的?

最佳答案

它与我一起工作
首先,您可以将 json 文件放在文件夹中,如果愿意,或者放在共享文件夹中
我把文件夹重命名为 Image

Animation="Images.loading.json"
在 c# 代码中
    animationView.AnimationSource = AnimationSource.EmbeddedResource;

关于c# - Lottie.Forms - 从 EmbeddedResources 加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53307273/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com