我有一个自定义TextView,我想在textview进入视图时设置一个动画(我已将其可见性限制在一个属性中)。我知道设置动画OnClick但我不能使用它,因为我使用的是MvvmCross和MvVM设计。
public class AnimatedTextView : TextView
{
protected AnimatedTextView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public AnimatedTextView(Context context) : base(context)
{
Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/fontawesome-webfont.ttf");
SetTypeface(tf, TypefaceStyle.Normal);
var spinInAnim = AnimationUtils.LoadAnimation(context, Resource.Animation.spinInAnimation);
Animation = spinInAnim;
}
public AnimatedTextView(Context context, IAttributeSet attrs) : base(context, attrs)
{
Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/fontawesome-webfont.ttf");
SetTypeface(tf, TypefaceStyle.Normal);
var spinInAnim = AnimationUtils.LoadAnimation(context, Resource.Animation.spinOutAnimation);
Animation = spinInAnim;
}
public AnimatedTextView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
{
Typeface tf = Typeface.CreateFromAsset(context.Assets, "Fonts/fontawesome-webfont.ttf");
SetTypeface(tf, TypefaceStyle.Normal);
var spinInAnim = AnimationUtils.LoadAnimation(context, Resource.Animation.spinOutAnimation);
Animation = spinInAnim;
}
}
我认为设置动画可以解决问题,但显然不是。有什么建议吗?