如何截取android布局的屏幕截图? [英] how to take a screenshot of an android layout?
本文介绍了如何截取android布局的屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是我如何使用内置的屏幕截图来截取屏幕截图.任何提示或示例代码将不胜感激.
my question is how do I take a screenshot using the built in screen capture. Any hints or sample code would be greatly appreciated.
推荐答案
有两种尝试方法,
- 使用Eclipse
在Eclipse中打开设备"视图(窗口"菜单->显示视图选项"->其他",Android->设备"),在右侧有一个工具栏按钮,标有 Screen Capture
Open the Devices view in Eclipse ( Window Menu --> Show View Option --> Other, Android --> Devices), and there's a toolbar button on the right side labeled Screen Capture
-
使用Android代码
Using Android Code
Bitmap bitmap;
View v1 = MyView.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
这篇关于如何截取android布局的屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文