在尝试在 Xamarin Forms Android 项目的 MainActivity.cs 中添加 Lottie 动画时,为什么会出现“AnimationViewRenderer 不存在于上下文错误”?我正在使用 Visual Studio 2017。
在尝试在 Xamarin Forms Android 项目的 MainActivity.cs 中添加 Lottie 动画时,为什么会出现“AnimationViewRenderer 不存在于上下文错误”?我正在使用 Visual Studio 2017。
尝试从2.7.0版本降级到2.6.3版本
AnimationViewRenderer.Init()
。但是,我甚至不需要初始化 AnimationViewRenderer
;我只需在我的页面上添加 Lottie XAML 组件,它就可以完美地工作。Dependencies
来检查 Lottie 所需的 Mono 版本。使用最新版本的Com.Airbnb.Xamarin.Forms.Lottie
,您不再需要调用AnimationViewRenderer.Init();
。
AnimationViewRenderer.Init();
在Android MainActivity中初始化表单后。
一篇很好的文章解释了整个过程:https://xamgirl.com/lottie-animations-step-by-step-in-xamarin-forms/