Compartir a través de


ImageView.SetImageURI(Uri) Method

Definition

Sets the content of this ImageView to the specified Uri.

[Android.Runtime.Register("setImageURI", "(Landroid/net/Uri;)V", "GetSetImageURI_Landroid_net_Uri_Handler")]
public virtual void SetImageURI (Android.Net.Uri? uri);
[<Android.Runtime.Register("setImageURI", "(Landroid/net/Uri;)V", "GetSetImageURI_Landroid_net_Uri_Handler")>]
abstract member SetImageURI : Android.Net.Uri -> unit
override this.SetImageURI : Android.Net.Uri -> unit

Parameters

uri
Uri

the Uri of an image, or null to clear the content

Attributes

Remarks

Sets the content of this ImageView to the specified Uri. Note that you use this method to load images from a local Uri only. <p/> To learn how to display images from a remote Uri see: Handling Bitmaps<p/> <p class="note">This does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that's a concern, consider using #setImageDrawable(Drawable) or #setImageBitmap(android.graphics.Bitmap) and android.graphics.BitmapFactory instead.</p>

<p class="note">On devices running SDK < 24, this method will fail to apply correct density scaling to images loaded from ContentResolver#SCHEME_CONTENT content and ContentResolver#SCHEME_FILE file schemes. Applications running on devices with SDK >= 24 <strong>MUST</strong> specify the targetSdkVersion in their manifest as 24 or above for density scaling to be applied to images loaded from these schemes.</p>

Java documentation for android.widget.ImageView.setImageURI(android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to