1
다음 코드를 사용하여 TableLayout의 스크린 샷을 찍습니다. 내 안드로이드 응용 프로그램의 테마가 LIGHT로 설정되어야한다고 덧붙여 야합니다. 그것은 마치 에뮬레이터 화면에서 완벽하게 잘 보여줍니다. (마치 ...) 그러나 일단 스크린 샷이 찍히면 이미지가 이렇게 변합니다. 아무도 내가 여기서 잘못하고있는 것을 지적 할 수 있습니까? ? 감사! 당신은 PNG를 사용한다스크린 샷 오류 (안드로이드)
private void getScreen()
{
View content = findViewById(R.id.TransactionLog);
content.setDrawingCacheEnabled(true);
content.buildDrawingCache(true);
Bitmap bitmap = Bitmap.createBitmap(content.getDrawingCache());
content.setDrawingCacheEnabled(false); // clear drawing cache
File file = new File(Environment.getExternalStorageDirectory() +
File.separator + "logDetails.jpeg");
try
{
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.JPEG, 100, ostream);
ostream.flush();
ostream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
if (!file.exists()) {
sendmail();
}
}
예! 그게 내 문제를 고쳤어 ... 고마워! – BurninatorDor