예제 #1
0
        public static Drawable FromUri(Uri uri)
        {
            var id       = ImageSource.FindResourceId(uri?.AbsoluteUri);
            var drawable = id.HasValue
                                ? ContextCompat.GetDrawable(ContextHelper.Current, id.Value)
                                : null;

            if (drawable != null)
            {
                // Makes the drawable compatible with DrawableCompat pre-Lollipop.
                drawable = Android.Support.V4.Graphics.Drawable.DrawableCompat.Wrap(drawable);
                drawable = drawable.Mutate();
            }

            return(drawable);
        }