Sdílet prostřednictvím


ImageView.SetImageResource(Int32) Method

Definition

Sets a drawable as the content of this ImageView.

[Android.Runtime.Register("setImageResource", "(I)V", "GetSetImageResource_IHandler")]
public virtual void SetImageResource (int resId);
[<Android.Runtime.Register("setImageResource", "(I)V", "GetSetImageResource_IHandler")>]
abstract member SetImageResource : int -> unit
override this.SetImageResource : int -> unit

Parameters

resId
Int32

the resource identifier of the drawable

Attributes

Remarks

Sets a drawable as the content of this ImageView. <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(android.graphics.drawable.Drawable) or #setImageBitmap(android.graphics.Bitmap) and android.graphics.BitmapFactory instead.</p>

Java documentation for android.widget.ImageView.setImageResource(int).

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