コード例 #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());
            }
        }