ObjectAnimator 自定义属性不起作用解决方法

引用Mono.Android.Export和Java.Interop;

    ObjectAnimator maskXAnimator =      ObjectAnimator.OfFloat(textView, "MaskX", 0, 200);
        maskXAnimator.RepeatCount = ValueAnimator.Infinite;
        maskXAnimator.SetDuration(1000);
        maskXAnimator.StartDelay = 0;


        //ViewCode
        //自定义属性
        private float maskX, maskY;
        //添加ExportAttribute就起作用
        [Export("getMaskX")]
        public float getMaskX()
        {
            return maskX;
        }

        [Export("setMaskX")]
        public void setMaskX(float maskX)
        {
            this.maskX = maskX;
            this.Invalidate();
        }

        [Export("getMaskY")]
        public float getMaskY()
        {
            return maskY;
        }

        [Export("setMaskY")]
        public void setMaskY(float maskY)
        {
            this.maskY = maskY;
            this.Invalidate();
        }

你可能感兴趣的:(Xamarin.Android)