1

是否可以从后台制作另一个应用程序的屏幕截图并将其转换为位图以在保存前进行一些更改?设备已植根。

我试过执行控制台命令,但它会自动将文件保存到磁盘,所以我需要读取文件,进行更改(显示给用户)并再次保存(或删除)。所以,要避免先保存。

顺便说一句,是否可以仅屏幕特定区域,而不是全屏?

4

3 回答 3

2

如果您可以制作系统应用程序(使用与您的 Android 系统相同的密钥签名的应用程序),那么您可以使用WindowManagerService.java API screenshotApplications()来返回屏幕截图的位图

有关更多详细信息,请通过WindowManagerService.java 源

于 2017-01-19T08:12:01.440 回答
2

另一种适用于无根设备的解决方案21+ API是使用MediaProjectionManager

这里是如何使用它的例子,这里是如何从服务中管理的

于 2017-04-18T06:11:00.027 回答
1
 No , you need to save the file before any processing is needed to be done on the image before. 
You can one thing is let the file be saved and then with proper permissions you can overwrite the file by :
1. creating a copy
2.making changes
3.deleting the original
4.renaming the changed file
于 2017-01-19T08:01:03.540 回答