我如何通過android.I屏幕捕獲的意思是我想編寫一個程序,使screen.any鏈接截圖感謝,謝謝大家以屏幕的screeshot通過Android手機
-1
A
回答
1
我使用此代碼截圖我的APP(你不能拍照的其他應用程序):
@SuppressLint("SimpleDateFormat")
protected final static boolean shoot
(final View v, final String appName)
{
// Get the bitmap from the view
v.setDrawingCacheEnabled(true);
boolean isOK = false;
final Bitmap bmp = v.getDrawingCache();
final SimpleDateFormat sdf = new SimpleDateFormat("[email protected]");
final Calendar cal = Calendar.getInstance();
// Set file properties
fileJPG = appName + "_" + sdf.format(cal.getTime());
/*
Create a path where we will place our picture in the user's public
pictures directory. Note that you should be careful about what you
place here, since the user often manages these files.
For pictures and other media owned by the application, consider
Context.getExternalMediaDir().
*/
final File path =
Environment.getExternalStoragePublicDirectory
(
Environment.DIRECTORY_DCIM + "/Your_App_Name/"
);
// Make sure the Pictures directory exists.
if(!path.exists())
{
path.mkdirs();
}
final File file = new File(path, fileJPG + ".jpg");
try
{
final FileOutputStream fos = new FileOutputStream(file);
final BufferedOutputStream bos =
new BufferedOutputStream(fos, 8192);
bmp.compress(CompressFormat.JPEG, 85, bos);
bos.flush();
bos.close();
fileJPG = file.getPath();
isOK = true;
}
catch (final IOException e)
{
e.printStackTrace();
}
return isOK;
}
3
這不是儘可能輕鬆地按照你的意願去做。出於安全原因,沒有官方的API。
這裏是你的選擇:
- 使用擷取畫面命令行工具:需要root權限,在所有手機
- 獲取幀緩衝區沒有安裝:需要root
- 使用android-screenshot-library:需要ADB連接爲開始
相關問題
- 1. 以Android手機的打印屏幕?
- 2. 點擊android手機屏幕
- 3. Android屏幕在不同的手機上
- 4. 手機屏幕上的Android繪圖
- 5. Android手機的屏幕位置發現
- 6. Android手機屏幕有多大?
- 7. Android UI LinearLayout出「手機屏幕」
- 8. Android將手機數據寫入屏幕
- 9. Android根植手機屏幕截圖
- 10. PIN碼屏幕手機間隙android
- 11. QRCODE圖像顯示Android手機屏幕
- 12. Android的 - 設置壁紙,以適應手機屏幕尺寸
- 13. 我可以獲得屏幕android手機的大小嗎?
- 14. 手機屏幕上的雙擊手勢
- 15. 通過iframe模擬手機屏幕尺寸
- 16. 如何通過CSS媒體查詢區分手機和屏幕?
- 17. 引導手機屏幕
- 18. android通過手指在屏幕上移除線條
- 19. Xamarin的Android FlyOutMenu通過Garuma - 多屏幕
- 20. 無法通過Android Market排除此應用的小屏手機
- 21. Android Studio:手機預覽,只顯示屏幕,而不是屏幕的周圍
- 22. android通過gridview填充所有屏幕
- 23. 如何通過ADB鎖定Android屏幕?
- 24. 保存錄制的手機屏幕
- 25. 手機屏幕內的可見區域
- 26. 添加到手機上的主屏幕
- 27. 手機屏幕上的顯示塊
- 28. UIWebview的contentSize不適合手機屏幕
- 29. 調整手機屏幕的靴帶行
- 30. 渲染大屏幕版本的手機
您的應用程序或任何應用程序? –
什麼?可以給我詳細信息 – sakir
您想截取自己的應用或任何應用的截圖嗎? –