捕获安卓屏幕
如何以编程方式在 Android 手机上执行屏幕捕获?
How can I programmatically perform a screen capture on an Android phone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何以编程方式在 Android 手机上执行屏幕捕获?
How can I programmatically perform a screen capture on an Android phone?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
尝试这样的事情:
try something like this:
除了在 root 手机上之外,您无法从 Android 应用程序执行此操作,因为您无权访问帧缓冲区设备。
不过,您可以从开发计算机的 DDMS 窗口通过 adb 来完成此操作,因为 adb 在具有帧缓冲区权限的图形组中运行。
如果您想在 root 设备上的本机代码中执行类似的操作,请查看 adb 守护程序的源代码。
编辑:看来这可能正在改变,并且在最近的 Android 版本中可能有非 root 功能,但我不确定细节。
You cannot do this from an android app except on a rooted phone, as you don't have permission to access the framebuffer device.
You can however do it over adb from the DDMS window of your development machine, as adb runs in the graphics group which has permission to the framebuffer.
If you want to do something similar in native code on a rooted device, look at the sources to the adb daemon.
EDIT: It appears this may be changing and there may be non-root capability in more recent android releases, but I'm not sure of the details.
以下是如何将视图转换为位图的示例。只需抓住您的俯视图并欣赏它即可。这绝对有效,而且您绝对不需要为此拥有 root 设备!
http://www.brighthub.com/mobile/google-android/articles /30676.aspx
Here's a sample of how to convert a view to a bitmap. Just grab your top view and have at it. This absolutely works and you ABSOLUTELY don't need to have a rooted device for this!
http://www.brighthub.com/mobile/google-android/articles/30676.aspx