Most visited

Recently visited

Added in API level 1

PackageItemInfo

public class PackageItemInfo
extends Object

java.lang.Object
   ↳ android.content.pm.PackageItemInfo
Known Direct Subclasses
Known Indirect Subclasses


包含包管理器保存的所有包项的公共信息的基类。 这提供了一组非常常见的基本属性:标签,图标和元数据。 本课程不打算单独使用; 只是在这里共享包管理器返回的所有项目之间的通用定义。 因此,它本身并不实现Parcelable,但确实提供了便利的方法来帮助在子类中实现Parcelable。

Summary

Nested classes

class PackageItemInfo.DisplayNameComparator

 

Fields

public int banner

此组件横幅的可绘制资源标识符(位于软件包资源中)。

public int icon

此组件图标的可绘制资源标识符(位于程序包的资源中)。

public int labelRes

此组件标签的字符串资源标识符(位于程序包的资源中)。

public int logo

此组件徽标的可绘制资源标识符(位于程序包的资源中)。

public Bundle metaData

与此组件关联的其他元数据。

public String name

这个项目的公开名称。

public CharSequence nonLocalizedLabel

AndroidManifest文件中提供的字符串(如果有的话)。

public String packageName

该项目所在的包的名称。

Public constructors

PackageItemInfo()
PackageItemInfo(PackageItemInfo orig)

Protected constructors

PackageItemInfo(Parcel source)

Public methods

Drawable loadBanner(PackageManager pm)

检索与此项目关联的当前图形横幅。

Drawable loadIcon(PackageManager pm)

检索与此项目关联的当前图形图标。

CharSequence loadLabel(PackageManager pm)

检索与该项目相关的当前文本标签。

Drawable loadLogo(PackageManager pm)

检索与此项目关联的当前图形徽标。

Drawable loadUnbadgedIcon(PackageManager pm)

检索与该项目关联的当前图形图标,而不添加工作标志(如果适用)。

XmlResourceParser loadXmlMetaData(PackageManager pm, String name)

加载附加到该项目的元数据的XML资源。

void writeToParcel(Parcel dest, int parcelableFlags)

Protected methods

void dumpBack(Printer pw, String prefix)
void dumpFront(Printer pw, String prefix)

Inherited methods

From class java.lang.Object

Fields

banner

Added in API level 20
int banner

此组件横幅的可绘制资源标识符(位于软件包资源中)。 从“banner”属性或者如果未设置,则为0。

icon

Added in API level 1
int icon

此组件图标的可绘制资源标识符(位于程序包的资源中)。 从“图标”属性或如果未设置,则为0。

labelRes

Added in API level 1
int labelRes

此组件标签的字符串资源标识符(位于程序包的资源中)。 从“标签”属性或如果未设置,则为0。

logo

Added in API level 9
int logo

此组件徽标的可绘制资源标识符(位于程序包的资源中)。 徽标可能比图标更大/更宽,并且由某些UI元素代替名称或名称/图标组合显示。 从“徽标”属性或者如果未设置,则为0。

metaData

Added in API level 1
Bundle metaData

与此组件关联的其他元数据。 如果您在请求信息时设置了GET_META_DATA标志,则只会填写该字段。

name

Added in API level 1
String name

这个项目的公开名称。 从“android:name”属性。

nonLocalizedLabel

Added in API level 1
CharSequence nonLocalizedLabel

AndroidManifest文件中提供的字符串(如果有的话)。 你可能不想使用这个。 你可能想要getApplicationLabel(ApplicationInfo)

packageName

Added in API level 1
String packageName

该项目所在的包的名称。

Public constructors

PackageItemInfo

Added in API level 1
PackageItemInfo ()

PackageItemInfo

Added in API level 1
PackageItemInfo (PackageItemInfo orig)

Parameters
orig PackageItemInfo

Protected constructors

PackageItemInfo

Added in API level 1
PackageItemInfo (Parcel source)

Parameters
source Parcel

Public methods

loadBanner

Added in API level 20
Drawable loadBanner (PackageManager pm)

检索与此项目关联的当前图形横幅。 这将回调给定的PackageManager从应用程序加载横幅。

Parameters
pm PackageManager: A PackageManager from which the banner can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
Drawable Returns a Drawable containing the item's banner. If the item does not have a banner, this method will return null.

loadIcon

Added in API level 1
Drawable loadIcon (PackageManager pm)

检索与此项目关联的当前图形图标。 这将回调给定的PackageManager从应用程序加载图标。

Parameters
pm PackageManager: A PackageManager from which the icon can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
Drawable Returns a Drawable containing the item's icon. If the item does not have an icon, the item's default icon is returned such as the default activity icon.

loadLabel

Added in API level 1
CharSequence loadLabel (PackageManager pm)

检索与该项目相关的当前文本标签。 这将回调给定的PackageManager从应用程序加载标签。

Parameters
pm PackageManager: A PackageManager from which the label can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
CharSequence Returns a CharSequence containing the item's label. If the item does not have a label, its name is returned.

loadLogo

Added in API level 9
Drawable loadLogo (PackageManager pm)

检索与此项目关联的当前图形徽标。 这将回调给定的PackageManager从应用程序加载徽标。

Parameters
pm PackageManager: A PackageManager from which the logo can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
Drawable Returns a Drawable containing the item's logo. If the item does not have a logo, this method will return null.

loadUnbadgedIcon

Added in API level 22
Drawable loadUnbadgedIcon (PackageManager pm)

检索与该项目关联的当前图形图标,而不添加工作标志(如果适用)。 这将回调给定的PackageManager从应用程序加载图标。

Parameters
pm PackageManager: A PackageManager from which the icon can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns
Drawable Returns a Drawable containing the item's icon. If the item does not have an icon, the item's default icon is returned such as the default activity icon.

loadXmlMetaData

Added in API level 1
XmlResourceParser loadXmlMetaData (PackageManager pm, 
                String name)

加载附加到该项目的元数据的XML资源。 这将检索名称元数据条目,并且如果在给定的PackageManager上定义回调以从应用程序加载其XML文件。

Parameters
pm PackageManager: A PackageManager from which the XML can be loaded; usually the PackageManager from which you originally retrieved this item.
name String: Name of the meta-date you would like to load.
Returns
XmlResourceParser Returns an XmlPullParser you can use to parse the XML file assigned as the given meta-data. If the meta-data name is not defined or the XML resource could not be found, null is returned.

writeToParcel

Added in API level 1
void writeToParcel (Parcel dest, 
                int parcelableFlags)

Parameters
dest Parcel
parcelableFlags int

Protected methods

dumpBack

Added in API level 1
void dumpBack (Printer pw, 
                String prefix)

Parameters
pw Printer
prefix String

dumpFront

Added in API level 1
void dumpFront (Printer pw, 
                String prefix)

Parameters
pw Printer
prefix String

Hooray!