コード例 #1
0
        private Drawable ResolveResource()
        {
            var rsrc = Resources;

            if (rsrc != null)
            {
                if (_resource != 0)
                {
                    try
                    {
                        var d = ContextCompat.GetDrawable(Context, _resource);

                        return(RoundedDrawable.FromDrawable(d));
                    }
                    catch (Exception e)
                    {
                        Log.Warn(Tag, "Unable to find resource: " + _resource, e);
                        // Don't try again.
                        _resource = 0;
                    }
                }
            }

            return(null);
        }
コード例 #2
0
        public override void SetImageBitmap(Bitmap bm)
        {
            _resource = 0;
            _drawable = RoundedDrawable.FromBitmap(bm);
            UpdateDrawableAttrs();

            base.SetImageDrawable(_drawable);
        }
コード例 #3
0
        public override void SetImageDrawable(Drawable drawable)
        {
            _resource = 0;
            _drawable = RoundedDrawable.FromDrawable(drawable);
            UpdateDrawableAttrs();

            base.SetImageDrawable(drawable);
        }
コード例 #4
0
        private void UpdateBackgroundDrawableAttrs(bool convert)
        {
            if (_mutateBackground)
            {
                if (convert)
                {
                    _backgroundDrawable = RoundedDrawable.FromDrawable(_backgroundDrawable);
                }

                UpdateAttrs(_backgroundDrawable);
            }
        }