鴻蒙OS LauncherShortcutInfo

2022-04-25 16:59 更新

LauncherShortcutInfo

java.lang.Object

|---ohos.bundle.LauncherShortcutInfo

public class LauncherShortcutInfo
extends Object

提供有關(guān)從主屏幕啟動(dòng)的應(yīng)用程序的啟動(dòng)器ability的快捷方式的信息。

該類提供了獲取快捷方式所屬應(yīng)用程序的快捷方式 ID、圖標(biāo)和包名稱的方法。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo) 用于創(chuàng)建 LauncherShortcutInfo 實(shí)例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
String getBundleName() 獲取該快捷方式所屬的應(yīng)用程序包名稱。
Element getIcon() 獲取該快捷方式的圖標(biāo)。
ListShortcutIntent getIntents() 獲取此快捷方式中包含的所有 ShortcutIntent 對(duì)象。
String getLabel() 獲取該快捷方式的標(biāo)簽。
String getShortcutId() 獲取此快捷方式的 ID。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細(xì)信息

LauncherShortcutInfo

public LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo)

用于創(chuàng)建 LauncherShortcutInfo 實(shí)例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 表示快捷方式的上下文對(duì)象。
shortcutInfo 指示有關(guān)快捷方式的信息。

方法詳情

getShortcutId

public String getShortcutId()

獲取此快捷方式的 ID。

快捷方式 ID 唯一標(biāo)識(shí)快捷方式。

返回:

返回快捷方式 ID。

getBundleName

public String getBundleName()

獲取該快捷方式所屬的應(yīng)用程序包名稱。

返回:

返回應(yīng)用程序的包名稱。

getLabel

public String getLabel()

獲取該快捷方式的標(biāo)簽。

快捷方式的標(biāo)簽是指快捷方式列表中顯示的標(biāo)題。

返回:

返回快捷方式標(biāo)簽。

getIntents

public ListShortcutIntent getIntents()

獲取此快捷方式中包含的所有 ShortcutIntent 對(duì)象。

ohos.bundle.ShortcutIntent 對(duì)象用于導(dǎo)航到快捷方式的目標(biāo)ability。

返回:

返回此快捷方式中所有 ohos.bundle.ShortcutIntent 對(duì)象的列表。

getIcon

public Element getIcon()

獲取該快捷方式的圖標(biāo)。

快捷方式圖標(biāo)顯示在快捷方式列表中。

返回:

返回快捷方式圖標(biāo)。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)