gpt4 book ai didi

java - 如何在自定义启动器上安装图标包?

转载 作者:IT老高 更新时间:2023-10-28 20:47:55 26 4
gpt4 key购买 nike

我正在尝试在我的自定义启动器上安装图标包,我已阅读此说明 How to install icon pack但我无法理解如何使用该类,这就是我所做的:

IconPackManager ic = new IconPackManager();
HashMap<String, IconPackManager.IconPack> map = new HashMap<String, IconPackManager.IconPack>(ic.getAvailableIconPacks(false));
Iterator it = map.entrySet().iterator();
Drawable d = null;
String packName = null;
IconPackManager.IconPack packIcon = null;
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
packName = (String)pair.getKey();
packIcon = (IconPackManager.IconPack)pair.getValue();
d = packIcon.getDrawableIconForPackage(packName, iconDrawable);
setIcon(d);
}

最佳答案

解决了这个问题:

String packName = null;
IconPackManager.IconPack packIcon = null;

IconPackManager ic = new IconPackManager();
HashMap<String, IconPackManager.IconPack> map = ic.getAvailableIconPacks(true);
Iterator it = map.entrySet().iterator();


while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
packName = (String)pair.getKey(); //Get icon pack name (app package)

packIcon = (IconPackManager.IconPack)pair.getValue(); //Get icons

if(packIcon.getDrawableIconForPackage("YourTargetPackageName", yourStandardIcon) != null) {

//Your own method for set icon
setIcon(packIcon.getDrawableIconForPackage("YourTargetPackageName", yourStandardIcon));

}else{
//Your own method for set icon
setIcon(yourStandardIcon);
}
}

关于java - 如何在自定义启动器上安装图标包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42751915/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com