Я хочу сохранить скриншот всего прокручиваемого макета, но он захватывает только ту часть, которая видна на экране.
Вот весь мой макет.
![enter image description here](https://i.stack.imgur.com/8dxDo.jpg)
Вот скриншот, который был захвачен:
![enter image description here](https://i.stack.imgur.com/Px8oM.jpg)
Вот код для скриншота:
private void takeScreenshot() {
View v1 = getWindow().getDecorView().getRootView();;
v1.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
saveScreenshot(bitmap,"filename");
}
public void saveScreenshot(Bitmap bitmap,String name) {
String mPath = Environment.getExternalStorageDirectory().toString() + "/" + name + ".jpg";
File imageFile = new File(mPath);
Msg.log(mPath);
try {
FileOutputStream outputStream = new FileOutputStream(imageFile);
int quality = 100;
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}