如何截图,或者它呈现前快照的看法? [英] How to screenshot or snapshot a view before it's rendered?

查看:122
本文介绍了如何截图,或者它呈现前快照的看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想之前它呈现为preVIEW创建视图的图像。

I want to create an image of a view before it's rendered as a preview.

我试过采取整体视图截图
但问题是,它给出了一个空白的位图,因为观点不当时渲染。

I tried Take a screenshot of a whole view but the problem is that it gives a blank bitmap because the view was not rendered at that time.

我也试过画缓存,但它给了我一个空白的位图,以及。

I also tried drawing cache, but it gives me a blank bitmap as well.

反正是有,它的屏幕上呈现之前,我可以创建一个视图的形象?

Is there anyway that I can create an image of a view before it's rendered on the screen?

在此先感谢!

推荐答案

每个查看类支持其当前显示的图像的创建。如下编码显示了一个例子。

Every View class support the creating of an image of its current display. The following coding shows an example for that.

# Build the Drawing Cache
view.buildDrawingCache();

# Create Bitmap
Bitmap cache = view.getDrawingCache();

# Save Bitmap
saveBitmap(cache);
view.destroyDrawingCache(); 

和它是不可能把它呈现的前视图的屏幕截图。

And it is not possible to take a screenshot of a view before it's rendered.

这篇关于如何截图,或者它呈现前快照的看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆