0
我想創建所有視圖的位圖,但我無法創建所有視圖的位圖,請幫我解決這個問題。如何獲取所有視圖中的所有視圖的scrollView中的框架佈局
我想創建所有視圖的位圖,但我無法創建所有視圖的位圖,請幫我解決這個問題。如何獲取所有視圖中的所有視圖的scrollView中的框架佈局
公共位圖覆蓋(FrameLayout裏frame_layout){
frame_layout.setDrawingCacheEnabled(true);
frame_layout.buildDrawingCache();
return frame_layout.getDrawingCache();
}
public void saveImage(){
Bitmap bitmap=overlay(print_layout);
try{
String path = Environment.getExternalStorageDirectory().toString()+ File.separator+"bitmap";
File path_file=new File(path);
path_file.mkdirs();
OutputStream fOut = null;
File file = new File(path+ File.separator+"print.png"); // the File to save to
fOut = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
fOut.flush();
fOut.close();
Log.d("sun","saved");
}
catch (Exception e){
Log.d("sun",e.toString());
}
}
我已經嘗試使用此代碼.. –
請發表您的代碼 – PriyankaChauhan
的可能的複製[轉換一個視圖沒有Android的顯示它爲位圖?](http://stackoverflow.com/questions/ 2801116 /轉換視圖到位圖,無需顯示它在Android) – Anjali