Xamarin Android Lottie 启动画面
Xamarin Android Lottie Splash Screen
https://www.project-respite.com/lottie-xamarin-forms/
我不知道我做错了什么。我按照教程中的步骤操作,但出现此错误 "View does not contain the definition of 'AddAnimationListner'..."
我也尝试过使用这些 [1]类:addAnimatorUpdateListener 和 addAnimationListner。
我该如何解决?
代码:
截屏
https://imgur.com/a/02KDU9w
using Android.Animation;
using Android.App;
using Android.Content;
using Android.OS;
using Lottie.Forms.Droid;
using Com.Airbnb.Lottie;
namespace RefrigerantID.Droid
{
[Activity(Theme = "@style/Theme.Splash",
MainLauncher = true,
NoHistory = true)]
public class SplashActivity : Activity, Animator.IAnimatorListener
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.splash);
var animationView = FindViewById(Resource.Id.animation_view);
animationView.AddAnimationListener(this);
}
public void OnAnimationCancel(Animator animation)
{
}
public void OnAnimationEnd(Animator animation)
{
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
}
public void OnAnimationRepeat(Animator animation)
{
}
public void OnAnimationStart(Animator animation)
{
}
}
}
那……
var animationView = FindViewById<LottieAnimationView>(Resource.Id.animation_view);
animationView.AddAnimationListener(this);
https://www.project-respite.com/lottie-xamarin-forms/
我不知道我做错了什么。我按照教程中的步骤操作,但出现此错误 "View does not contain the definition of 'AddAnimationListner'..."
我也尝试过使用这些 [1]类:addAnimatorUpdateListener 和 addAnimationListner。
我该如何解决?
代码: 截屏 https://imgur.com/a/02KDU9w
using Android.Animation;
using Android.App;
using Android.Content;
using Android.OS;
using Lottie.Forms.Droid;
using Com.Airbnb.Lottie;
namespace RefrigerantID.Droid
{
[Activity(Theme = "@style/Theme.Splash",
MainLauncher = true,
NoHistory = true)]
public class SplashActivity : Activity, Animator.IAnimatorListener
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.splash);
var animationView = FindViewById(Resource.Id.animation_view);
animationView.AddAnimationListener(this);
}
public void OnAnimationCancel(Animator animation)
{
}
public void OnAnimationEnd(Animator animation)
{
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
}
public void OnAnimationRepeat(Animator animation)
{
}
public void OnAnimationStart(Animator animation)
{
}
}
}
那……
var animationView = FindViewById<LottieAnimationView>(Resource.Id.animation_view);
animationView.AddAnimationListener(this);