해결, 나는 스크린 샷을 취할 코드가 될 수 없습니다 :이 LayoutRoot는 내가 안드로이드 자바 프로그래밍 초보자 해요
"layoutroot cannot be resolved or is not a field"
I 돈 : 그것은 오류를 제공
을View content = findViewById(R.id.layoutroot); //it gives the "layoutroot cannot be resolved or is not a field" error
content.setDrawingCacheEnabled(true);
Bitmap bitmap = content.getDrawingCache();
File file = new File(Environment.getExternalStorageDirectory() + "/test.png");
try
{
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
내가 "layoutroot"를 정의해야하는지 알지 못한다. 누구든지이 문제를 해결할 수 있습니까? 고맙습니다!
가져 오기가 없습니다. 하지만 layoutroot는 어디에도 정의되어 있지 않습니다. 버튼과리스트 뷰가 있지만 layoutroot는 없습니다. 그것을 정의해야합니까? –
아직 해결하지 못했습니다. –
예, 분명히 선언해야합니다! –