欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android8.1去掉 Launcher3 默认给 icon 增加的APK图标白边

程序员文章站 2022-06-30 16:36:18
...

icon 增加的APK图标白边介绍:http://blog.csdn.net/guolin_blog/article/details/79417483
源码修改的路径:packages\apps\Launcher3\src\com\android\launcher3\graphics\LauncherIcons.java
if 部分直接注释,默认走 else 部分,不添加白边

    /*if (Utilities.ATLEAST_OREO && iconAppTargetSdk >= Build.VERSION_CODES.O) {
        boolean[] outShape = new boolean[1];
        AdaptiveIconDrawable dr = (AdaptiveIconDrawable)
                context.getDrawable(R.drawable.adaptive_icon_drawable_wrapper).mutate();
        dr.setBounds(0, 0, 1, 1);
        scale = normalizer.getScale(icon, null, dr.getIconMask(), outShape);
        if (FeatureFlags.LEGACY_ICON_TREATMENT &&
                !outShape[0]){
            Drawable wrappedIcon = wrapToAdaptiveIconDrawable(context, icon, scale);
            if (wrappedIcon != icon) {
                icon = wrappedIcon;
                scale = normalizer.getScale(icon, null, null, null);
            }
        }
    } else {
        scale = normalizer.getScale(icon, null, null, null);
    }*/
	scale = normalizer.getScale(icon, null, null, null);

编译安卓部分,下载镜像结果如下:
修改前:
Android8.1去掉 Launcher3 默认给 icon 增加的APK图标白边
修改后:
Android8.1去掉 Launcher3 默认给 icon 增加的APK图标白边