gpt4 book ai didi

c# - 如何为 Xamarin.forms 实现 Lottie?

转载 作者:行者123 更新时间:2023-11-30 19:54:01 24 4
gpt4 key购买 nike

我浏览了有关如何实现 Lottie 动画库的文档。

我为 Xamarin.Forms 1.0.0.7 添加了 NuGet 包 Lottie,在为 Xamarin Forms 调试我的 android 项目时,它构建时没有错误,但没有在我的项目中显示 json 文件的动画。

最佳答案

Lottie 在 Xamarin 表单中一步一步:

  1. 在所有项目中安装 Lottie 包
  2. 使用 AnimationViewRenderer.Init() 在 Android 和 iOS 项目中初始化 Lottie;
  3. 在 XAML 中或使用 CodeBehind 添加您的 View ,对于 XAML,您必须添加引用 xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms"
  4. 将您的 JSON 添加到您的项目中:

在 iOS 中将其添加到您的项目中并确保您在 Bundle Resource 中具有构建操作

在 Android 中,将它放在你的 Assets 文件夹中,并确保你在 Android Asset 中有构建操作

您可以在此处找到示例:

https://xamgirl.com/lottie-animations-step-by-step-in-xamarin-forms/

关于c# - 如何为 Xamarin.forms 实现 Lottie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44647571/

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