나는 비트 맵에 뷰를 렌더링하고 비트 맵을 저장하고 싶다. 하지만 그걸 화면에서 모두해야합니다.안드로이드에서 비트 맵에서 비트 맵으로 화면을 비우는 것
나는이 시도했다 :
LayoutInflater inflater = getLayoutInflater();
View linearview = (View) findViewById(R.id.linearview);
linearview = inflater.inflate(R.layout.intro, null);
Bitmap bm = Bitmap.createBitmap(linearview.getMeasuredWidth(), linearview.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bm);
linearview.layout(0, 0, linearview.getLayoutParams().width, linearview.getLayoutParams().height);
linearview.draw(c);
String extStorageDirectory = Environment.getExternalStorageState().toString();
extStorageDirectory = Environment.getExternalStorageDirectory().toString();
OutputStream outStream = null;
File file = new File(extStorageDirectory, "screen1.PNG");
try {
outStream = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
편집 : 내 응용 프로그램 충돌보기 나던은 폭이나 높이가 있기 때문이다. (조치는 그것을 해결하기위한 시도입니다)
그리고 나쁜 영어에 상처를 입히십시오.
가 충돌에 대해 물어 당신은 항상 – jqpubliq
내가이를 설정하는 방법 서비스 –
에서 작업을 수행하여 추적을 게시해야 레이아웃 서비스? –