今天就跟大家聊聊有关Android应用中怎么截取手机屏幕,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。方法1:首先想到的思路是利用SDK提供的View.getDrawinGCache
今天就跟大家聊聊有关Android应用中怎么截取手机屏幕,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
方法1:首先想到的思路是利用SDK提供的View.getDrawinGCache()方法:
public void printScreen(View view) { String imgPath = "/sdcard/test.png"; view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap bitmap = view.getDrawingCache(); if (bitmap != null) { try { FileOutputStream out = new FileOutputStream(imgPath); bitmap.compress(Bitmap.CompressFORMat.PNG, 100, out); } catch (Exception e) { e.printStackTrace(); } } }
--结束END--
本文标题: Android应用中怎么截取手机屏幕
本文链接: https://www.lsjlt.com/news/223402.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0