以下功能在android 8之前都可以使用,但在pie上不起作用:
public static Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bmp1, new Matrix(), null);
canvas.drawBitmap(bmp2, 0, 0, null);
return bmOverlay;
}
所需的输出进入Pie下方:函数的第一个参数是图片捕获的输出,第二个参数是标题视图的位图。
饼图输出:
查看位图的方式:
public static Bitmap viewtoBitmap(View view,int width,int hight){
Bitmap bitmap=Bitmap.createBitmap(width,hight,Bitmap.Config.ARGB_8888);
Canvas canvas=new Canvas(bitmap);
view.draw(canvas);
return bitmap;
}
答案 0 :(得分:0)
以下功能在Pie(9)和Q(10)设备中正常工作:
public static Bitmap mergeBitmap(Bitmap bmp1, Bitmap bmp2) {
Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bmp1, new Matrix(), null);
canvas.drawBitmap(bmp2, new Matrix(), null);
return bmOverlay;
}