取整查看截图 [英] Take a screenshot of a whole View
本文介绍了取整查看截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我建立了一个表,基本上是由 HorizontalScrollView
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;
}
这篇关于取整查看截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文