다음을 통해 공유


ImageView.SetImageIcon(Icon) Method

Definition

Sets the content of this ImageView to the specified Icon.

[Android.Runtime.Register("setImageIcon", "(Landroid/graphics/drawable/Icon;)V", "GetSetImageIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=23)]
public virtual void SetImageIcon (Android.Graphics.Drawables.Icon? icon);
[<Android.Runtime.Register("setImageIcon", "(Landroid/graphics/drawable/Icon;)V", "GetSetImageIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=23)>]
abstract member SetImageIcon : Android.Graphics.Drawables.Icon -> unit
override this.SetImageIcon : Android.Graphics.Drawables.Icon -> unit

Parameters

icon
Icon

an Icon holding the desired image, or null to clear the content

Attributes

Remarks

Sets the content of this ImageView to the specified Icon.

<p class="note">Depending on the Icon type, this may do Bitmap reading and decoding on the UI thread, which can cause UI jank. If that's a concern, consider using Icon#loadDrawableAsync(Context, Icon.OnDrawableLoadedListener, Handler) and then #setImageDrawable(android.graphics.drawable.Drawable) instead.</p>

Java documentation for android.widget.ImageView.setImageIcon(android.graphics.drawable.Icon).

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