Android代码-非常优雅的方案实现屏幕截图,利用android 5.0之后的录屏API实现截屏

上传者: 39840588 | 上传时间: 2021-05-31 18:43:02 | 文件大小: 122KB | 文件类型: ZIP
AndroidScreenShot_SysApi 非常优雅的方案实现屏幕截图,利用android 5.0 之后的录屏API获取一帧画面,来实现截屏。 特性 方便后台service调用截屏功能。 打破老旧的截屏方案,只能截当前activity不能截状态栏的问题。 使用 直接编译代码run,等待toast成功. 注意:目前代码截图成功后保存到使用外置私有存储,不需要申请外部存储权限,所以不要惊讶,不会崩溃的。 自定义使用 直接使用Shotter,或者直接使用ScreenShotActivity。 更多拓展: > 因为他是一个透明并隐藏的activity,玩法有很多: 3.1截图桌面; 3.2对其他app进行截图:你自己试着调整shotter的delay时间为3秒,然后start截图,再切换到其他app里,等toast截图成功。 3.3从service里启动:你要改manifaest,配置action,从service里启动试试,代码里有。

文件下载

资源详情

[{"title":"( 41 个子文件 122KB ) Android代码-非常优雅的方案实现屏幕截图,利用android 5.0之后的录屏API实现截屏","children":[{"title":"AndroidScreenShot_SysApi-master","children":[{"title":"gradlew.bat <span style='color:#111;'> 2.26KB </span>","children":null,"spread":false},{"title":"gradlew <span style='color:#111;'> 4.85KB </span>","children":null,"spread":false},{"title":"gradle.properties <span style='color:#111;'> 855B </span>","children":null,"spread":false},{"title":"LICENSE_CN <span style='color:#111;'> 1.96KB </span>","children":null,"spread":false},{"title":"License <span style='color:#111;'> 34.32KB </span>","children":null,"spread":false},{"title":"LICENSE <span style='color:#111;'> 2.52KB </span>","children":null,"spread":false},{"title":"app","children":[{"title":"proguard-rules.pro <span style='color:#111;'> 671B </span>","children":null,"spread":false},{"title":"src","children":[{"title":"test","children":[{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"androidscreenshot_sysapi","children":[{"title":"ExampleUnitTest.java <span style='color:#111;'> 333B </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":"androidTest","children":[{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"androidscreenshot_sysapi","children":[{"title":"ApplicationTest.java <span style='color:#111;'> 371B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"main","children":[{"title":"res","children":[{"title":"mipmap-xxxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 10.24KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-hdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 3.34KB </span>","children":null,"spread":false}],"spread":false},{"title":"values","children":[{"title":"colors.xml <span style='color:#111;'> 208B </span>","children":null,"spread":false},{"title":"strings.xml <span style='color:#111;'> 87B </span>","children":null,"spread":false},{"title":"styles.xml <span style='color:#111;'> 383B </span>","children":null,"spread":false},{"title":"dimens.xml <span style='color:#111;'> 211B </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 7.54KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-mdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.15KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 4.73KB </span>","children":null,"spread":false}],"spread":false},{"title":"layout","children":[{"title":"activity_main.xml <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false}],"spread":false},{"title":"values-w820dp","children":[{"title":"dimens.xml <span style='color:#111;'> 358B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"androidscreenshot_sysapi","children":[{"title":"ScreenShotService.java <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"MainActivity.java <span style='color:#111;'> 786B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"AndroidManifest.xml <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 730B </span>","children":null,"spread":false}],"spread":true},{"title":"gradle","children":[{"title":"wrapper","children":[{"title":"gradle-wrapper.jar <span style='color:#111;'> 52.38KB </span>","children":null,"spread":false},{"title":"gradle-wrapper.properties <span style='color:#111;'> 230B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".gitignore <span style='color:#111;'> 591B </span>","children":null,"spread":false},{"title":"libshot","children":[{"title":"proguard-rules.pro <span style='color:#111;'> 671B </span>","children":null,"spread":false},{"title":"src","children":[{"title":"test","children":[{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"lib","children":[{"title":"ExampleUnitTest.java <span style='color:#111;'> 312B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":"androidTest","children":[{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"lib","children":[{"title":"ApplicationTest.java <span style='color:#111;'> 350B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"main","children":[{"title":"res","children":[{"title":"values","children":[{"title":"strings.xml <span style='color:#111;'> 66B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"java","children":[{"title":"com","children":[{"title":"androidyuan","children":[{"title":"lib","children":[{"title":"screenshot","children":[{"title":"Shotter.java <span style='color:#111;'> 7.53KB </span>","children":null,"spread":false},{"title":"ScreenShotActivity.java <span style='color:#111;'> 2.72KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"AndroidManifest.xml <span style='color:#111;'> 267B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"release","children":[{"title":"screenshot.jar <span style='color:#111;'> 22B </span>","children":null,"spread":false}],"spread":false},{"title":"build.gradle <span style='color:#111;'> 996B </span>","children":null,"spread":false}],"spread":true},{"title":"README.md <span style='color:#111;'> 996B </span>","children":null,"spread":false},{"title":"settings.gradle <span style='color:#111;'> 27B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 739B </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • passself :
    service怎么调用的?
    2021-03-23
  • 狐狸100 :
    版本预设范围太大,不过可以用
    2020-06-29
  • haiqiancun :
    不错,解决了我一大难题
    2020-05-26

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明