Language

ShortcutInfo.Builder.SetIcon(Icon) Method

Definition

Sets an icon of a shortcut.

[Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Icon;)Landroid/content/pm/ShortcutInfo$Builder;", "GetSetIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=25)]
public virtual Android.Content.PM.ShortcutInfo.Builder SetIcon(Android.Graphics.Drawables.Icon? icon);
[<Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Icon;)Landroid/content/pm/ShortcutInfo$Builder;", "GetSetIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=25)>]
abstract member SetIcon : Android.Graphics.Drawables.Icon -> Android.Content.PM.ShortcutInfo.Builder
override this.SetIcon : Android.Graphics.Drawables.Icon -> Android.Content.PM.ShortcutInfo.Builder

Parameters

icon
Icon

Returns

Attributes

Remarks

Sets an icon of a shortcut. Icons are not available on ShortcutInfo instances returned by ShortcutManager or LauncherApps. The default launcher app can use LauncherApps.getShortcutIconDrawable(ShortcutInfo,int) or LauncherApps.getShortcutBadgedIconDrawable(ShortcutInfo,int) to fetch shortcut icons. Tints set with Icon.setTint or Icon.setTintList are not supported and will be ignored. Only icons created with Icon.createWithBitmap(Bitmap), Icon.createWithAdaptiveBitmap(Bitmap) and Icon.createWithResource are supported. Other types, such as URI-based icons, are not supported.

Android reference for android.content.pm.ShortcutInfo.Builder.setIcon.

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