Lottie.Forms - 从 EmbeddedResources 加载

Dan*_*tin 14 c# xamarin.forms lottie

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" />
Run Code Online (Sandbox Code Playgroud)

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

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

Ema*_*nan 1

它一开始对我有用,你可以将 json 文件放在文件夹中(如果你愿意)或共享文件夹中

我把文件夹重命名为Image

Animation="Images.loading.json"
Run Code Online (Sandbox Code Playgroud)

在 c# 代码中放置

    animationView.AnimationSource = AnimationSource.EmbeddedResource;
Run Code Online (Sandbox Code Playgroud)