关于谷歌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
网友评论