取整查看截图截图

由网友(xx一问三不知)分享简介:我建立了一个表,基本上是由 Horizo​​ntalScrollView A 滚动型中完成。我做了,用户可以编辑的字段。I have built a table which is basically done by HorizontalScrollView inside a ScrollView. I made t...

我建立了一个表,基本上是由 Horizo​​ntalScrollView A 滚动型中完成。我做了,用户可以编辑的字段。

I have built a table which is basically done by HorizontalScrollView inside a ScrollView. I made the user can edit the fields.

现在我要保存表上显示的画面,JPG,PNG,PDF或其他任何东西。

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?

推荐答案

其实我找到了答案:

public static Bitmap loadBitmapFromView(View v, int width, int height) {
    Bitmap b = Bitmap.createBitmap(width , height, Bitmap.Config.ARGB_8888);                
    Canvas c = new Canvas(b);
    v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
    v.draw(c);
    return b;
}
阅读全文

相关推荐

最新文章