Udostępnij za pośrednictwem


IMenuItem.SetIcon Method

Definition

Overloads

SetIcon(Drawable)

Change the icon associated with this item.

SetIcon(Int32)

Change the icon associated with this item.

SetIcon(Drawable)

Change the icon associated with this item.

[Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;", "GetSetIcon_Landroid_graphics_drawable_Drawable_Handler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem SetIcon (Android.Graphics.Drawables.Drawable? icon);
[<Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;", "GetSetIcon_Landroid_graphics_drawable_Drawable_Handler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetIcon : Android.Graphics.Drawables.Drawable -> Android.Views.IMenuItem

Parameters

icon
Drawable

The new icon (as a Drawable) to be displayed.

Returns

This Item so additional setters can be called.

Attributes

Remarks

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See Menu for the menu types that support icons.

Java documentation for android.view.MenuItem.setIcon(android.graphics.drawable.Drawable).

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

SetIcon(Int32)

Change the icon associated with this item.

[Android.Runtime.Register("setIcon", "(I)Landroid/view/MenuItem;", "GetSetIcon_IHandler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem SetIcon (int iconRes);
[<Android.Runtime.Register("setIcon", "(I)Landroid/view/MenuItem;", "GetSetIcon_IHandler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetIcon : int -> Android.Views.IMenuItem

Parameters

iconRes
Int32

The new icon (as a resource ID) to be displayed.

Returns

This Item so additional setters can be called.

Attributes

Remarks

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See Menu for the menu types that support icons.

This method will set the resource ID of the icon which will be used to lazily get the Drawable when this item is being shown.

Java documentation for android.view.MenuItem.setIcon(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