简体   繁体   English

如何向Android启动器添加自定义图标主题支持

[英]How to add custom icon theme support to android launcher

I am working on an android launcher, I want to add icon theme support to the launcher. 我正在开发一个Android启动器,我想向启动器添加图标主题支持。 The launcher uses launcher-2 source code . 启动器使用launcher-2源代码 How to add theme support for Icons? 如何为图标添加主题支持?

You have to traverse through the appfilter.xml file in icon pack and set drawable for the curresponding package name defined in the appfilter.xml file ... use XmlPullParser class to manipulate xml data.... 您必须遍历图标包中的appfilter.xml文件,并将appdraw.xml文件中定义的当前包名称设置为drawable……使用XmlPullParser类来处理xml数据。

here is a basic idea... 这是一个基本的想法...

Resources resources = packageManager.getResourcesForApplication(packageName);
int xmlResId = resources.getIdentifier("appfilter", "xml", packageName);

if (xmlResId != 0) {
    XmlPullParser xpp = resources.getXml(xmlResId);
    // manipulate data using xpp
}

Some old icon packs has a different xml structure some has appfilter.xml in asset folder ... 一些旧的图标包具有不同的xml结构,一些在资产文件夹中具有appfilter.xml ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM