android怎么在launcher修改内置apk的icon

找到launcher下的IconCache中添加变量用来存储要修改apk的包名 及要修改成的icon

    private String[] className = {"com.google.android.apps.maps","com.google.android.googlequicksearchbox"};
    private int[]  resId = {R.drawable.com_android_google_map,R.drawable.com_android_googlesearch};

在cacheLocked方法中添加如下代码


 if (SystemProperties.getBoolean("persist.sys.ts18.sp025",false)) {
            Resources res = mContext.getResources();
            for (int i = 0; i < className.length; i++) {
                if (componentName.getPackageName().equals(className[i])) {
                    entry.icon = BitmapFactory.decodeResource(res,resId[i]);
                } else {
                    entry.icon = Utilities.createIconBitmap(
                            getFullResIcon(info), mContext);
                }
            }
            } else {
                entry.icon = Utilities.createIconBitmap(
                        getFullResIcon(info), mContext);
            }


修改title同理

你可能感兴趣的:(android开发)