我在AnimationListener中遇到问题:
内部Animation.AnimationListener animationListener = new AnimatorHolder();
private class AnimatorHolder : Animation.AnimationListener {
public int ChildCount { get; private set; }
public AnimatorHolder() {
}
[Override()]
public void onAnimationStart(Animation animation) {
}
[Override()]
public void onAnimationEnd(Animation animation) {
if (ChildCount > 1) {
RemoveViewAt(0);
}
}
[Override()]
public void onAnimationCancel(Animation animation) {
}
[Override()]
public void onAnimationRepeat(Animation animation) {
}
}
并且RemoveViewAt(0);
答案 0 :(得分:0)
这些Listener
类的存在只是因为它是您在Java中编程的方式,因此Xamarin团队将其准确地转换为C#。但是,他们使用C#方式使用事件将所有这些方法放入Animation
类。
因此,在您的Animation
课程中,您需要做的就是连接事件:
Animation MyAnimation = new Animation();
...
MyAnimation.AnimationEnd += (s,e) => {
if (ChildCount > 1) {
RemoveViewAt(0);
}
}
请参阅以下文档:https://developer.xamarin.com/api/type/Android.Views.Animations.Animation/