美文网首页
IllegalArgumentException"path mu

IllegalArgumentException"path mu

作者: Sunny君907 | 来源:发表于2018-04-02 21:59 被阅读0次

关于谷歌play的图标背景为黑色问题

/*Bitmap.Config config =

                drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888

                        : Bitmap.Config.RGB_565;*/

        Bitmap.Config config = Bitmap.Config.ARGB_4444;

当报错if (!convexPath.isConvex()) throw new IllegalArgumentException("path must be convex");

将drawable改为bitmap即可

public static Bitmap getBitmapFromDrawable(@NonNull Drawable drawable) {

        final Bitmap bmp = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);

        final Canvas canvas = new Canvas(bmp);

        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());

        drawable.draw(canvas);

        return bmp;

    }

将icon.setBackground 改成icon.setImageBitmap

相关文章

网友评论

      本文标题:IllegalArgumentException"path mu

      本文链接:https://www.haomeiwen.com/subject/iniwqftx.html