예제 #1
0
        void SetImageViewTintColor(ImageView image, Forms.Color color)
        {
            if (color == Forms.Color.Default)
            {
                image.ClearColorFilter();
            }

            image.SetColorFilter(new PorterDuffColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn ?? throw new NullReferenceException()));
        }
예제 #2
0
        void SetImageViewTintColor(ImageView image, Forms.Color color)
        {
            if (color == Forms.Color.Default)
            {
                image.ClearColorFilter();
            }

            image.SetColorFilter(new PorterDuffColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn));
        }
예제 #3
0
        void SetButtonTintColor(Button button, Forms.Color color)
        {
            var drawables = button.GetCompoundDrawables().Where(d => d != null);

            if (color == Forms.Color.Default)
            {
                foreach (var img in drawables)
                {
                    img.ClearColorFilter();
                }
            }

            foreach (var img in drawables)
            {
                img.SetTint(color.ToAndroid());
            }
        }