I have built a table which is basically done by HorizontalScrollView
inside a ScrollView
. I made the user can edit the fields.
Now I want to save the table on a screen, jpg, png, pdf or anything else.
The problem is - the table is nearly always bigger than the screen.
Is there a way to make a screenshot of the whole ScrollView
layout? If not what do you think can do the job?
Open the webpage you want to capture, then press and hold “Ctrl” + “Alt.” Then, press the “Prtsc” key. Left-click on the corner of the red highlighted box and drag to select the screenshot area. Once you release the mouse, the page will start slowly scrolling on its own.
Actually I found the answer:
public static Bitmap loadBitmapFromView(View v) { Bitmap b = Bitmap.createBitmap(v.getWidth() , v.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.draw(c); return b; }
ScrollView iv = (ScrollView) findViewById(R.id.scrollView); Bitmap bitmap = Bitmap.createBitmap( iv.getChildAt(0).getWidth(), iv.getChildAt(0).getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(bitmap); iv.getChildAt(0).draw(c); // Do whatever you want with your bitmap saveBitmap(bitmap);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With