Android 安卓11可以';t获取完整屏幕截图滚动查看

Android 安卓11可以';t获取完整屏幕截图滚动查看,android,screenshot,Android,Screenshot,我有一个活动,收据,我想在其中拍摄一个滚动视图的完整屏幕截图。然而,在android 11(在Google Pixel 2上测试)中,这段代码对我不起作用: Bitmap bitmap = getBitmapFromView(scrollview, scrollview.getChildAt(0).getHeight(), scrollview.getChildAt(0).getWidth()); //create bitmap from the ScrollView private Bit

我有一个活动,收据,我想在其中拍摄一个滚动视图的完整屏幕截图。然而,在android 11(在Google Pixel 2上测试)中,这段代码对我不起作用:

Bitmap bitmap = getBitmapFromView(scrollview, scrollview.getChildAt(0).getHeight(), scrollview.getChildAt(0).getWidth());

//create bitmap from the ScrollView 
private Bitmap getBitmapFromView(View view, int height, int width) {
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Drawable bgDrawable = view.getBackground();
    if (bgDrawable != null)
        bgDrawable.draw(canvas);
    else
        canvas.drawColor(Color.WHITE);
    view.draw(canvas);
    return bitmap;
}
屏幕截图有效,但不是完整的屏幕截图。

相关:相关: