效果圖:
關鍵**如下:
整個螢幕截圖(不包含狀態列)
public bitmap screenshot()
整個螢幕截圖(包含狀態列) 呼叫系統錄屏、截圖功能控制項截圖
private bitmap viewshot(linearlayout linearlayout)
bitmap = bitmap.createbitmap(linearlayout.getwidth(), h, bitmap.config.argb_8888);
canvas canvas = new canvas(bitmap);
linearlayout.draw(canvas);
return bitmap;
}
滾動截圖
private bitmap scrollershot(scrollview scrollview)
//建立bitmap
bitmap = bitmap.createbitmap(scrollview.getwidth(), h, bitmap.config.argb_8888);
canvas canvas = new canvas(bitmap);
scrollview.draw(canvas);
return bitmap;
}
列表截圖listview
public bitmap shotlistview(listview listview)
bitmap bigbitmap =
bitmap.createbitmap(listview.getmeasuredwidth(), allitemsheight, bitmap.config.argb_8888);
canvas bigcanvas = new canvas(bigbitmap);
paint paint = new paint();
int iheight = 0;
for (int i = 0; i < bmps.size(); i++)
return bigbitmap;
}
recyclerview
public bitmap shotrecyclerview(recyclerview view)
height += holder.itemview.getmeasuredheight();
}bigbitmap = bitmap.createbitmap(view.getmeasuredwidth(), height, bitmap.config.argb_8888);
canvas bigcanvas = new canvas(bigbitmap);
drawable lbackground = view.getbackground();
if (lbackground instanceof colordrawable)
for (int i = 0; i < size; i++)
}return bigbitmap;
}
webview截圖
private bitmap webviewshot(webview webview)
Android截圖方式
2017.5.6安卓巴士全球開發者論壇 廈門站 這個初夏 小巴仔想和程式設計師哥哥去廈門玩耍 你來嗎?android截圖 android截圖的原理 獲取具體需要截圖的區域的bitmap,然後繪製在畫布上,儲存為後進行分享或者其它用途 在截圖功能中,有時需要擷取全屏的內容,有時需要擷取超過一屏的內容 ...
Android截圖分享
android截圖並進行分享應該是乙個比較好用的功能,可惜在應用中見的不多 1.截圖 準備截圖 public void prepareshoot imgpath rootpath if imgpathfile.equals imgpath colorgoshareimga.png else else...
Android 實現截圖
android實現截圖功能,使用view的方法,得到以時間戳命名的png view view v.getrootview view.setdrawingcacheenabled true view.builddrawingcache bitmap bitmap1 view.getdrawingcac...