private void StartColorButtonClick(object sender, EventArgs e)
 {
     _animation = (AnimationDrawable)_gradientImageView.Background;
     _animation.SetEnterFadeDuration(ms: 1000);
     _animation.SetExitFadeDuration(ms: 2000);
     _animation.Start();
 }
Пример #2
0
        public void Start()
        {
            if (linearLayout != null)
            {
                linearLayout.SetBackgroundResource(drawableId);
            }
            else if (relativeLayout != null)
            {
                relativeLayout.SetBackgroundResource(drawableId);
            }
            else
            {
                imageView?.SetBackgroundResource(drawableId);
            }

            if (linearLayout != null)
            {
                frameAnimation = (AnimationDrawable)linearLayout.Background;
            }
            else if (relativeLayout != null)
            {
                frameAnimation = (AnimationDrawable)relativeLayout.Background;
            }
            else if (imageView != null)
            {
                frameAnimation = (AnimationDrawable)imageView.Background;
            }
            frameAnimation.SetEnterFadeDuration(duration);
            frameAnimation.SetExitFadeDuration(duration);
            frameAnimation.Start();
        }
Пример #3
0
        private void AddBackgroundAnimations()
        {
            CoordinatorLayout rootLayout        = (CoordinatorLayout)FindViewById(Resource.Id.root_layout);
            AnimationDrawable animationDrawable = (AnimationDrawable)rootLayout.Background;

            animationDrawable.SetEnterFadeDuration(2000);
            animationDrawable.SetExitFadeDuration(4000);
            animationDrawable.Start();
        }