0
안녕하세요, 좋은 하루 보내세요, 나는 프로그래밍 방식으로 화면 캡처를 캡처했지만 성공했지만 Google지도 조각은 화면 캡처 결과의 검은 색 페이지 만 표시합니다. 내 화면 캡처에지도를 표시하려면 어떻게해야합니까? 당신이 당신의 장치에서 Google Map
를 표시 할 수없는 경우, 아마 당신은 당신의 구글 맵 V2 API KEY
구글 developer console
에와 당신의 Androidmanifest.xml
에 넣어하지 않았다이다화면 캡처에 google지도 표시
public void download (View v){
View view = findViewById(R.id.layout_id);
view.setDrawingCacheEnabled(true);
Bitmap bitmap = view.getDrawingCache();
BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap);
//ImageView iv = (ImageView) findViewById(R.id.imageView1);
FrameLayout iv = (FrameLayout)findViewById(R.id.map);
//iv.setBackgroundDrawable(bitmapDrawable);
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
//we check if external storage is available, otherwise display an error message to the user
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard.getAbsolutePath() + "/Transit_Guide_Downloads");
directory.mkdirs();
String filename = "download_" + i + ".jpg";
File yourFile = new File(directory, filename);
while (yourFile.exists()) {
i++;
filename = "download_" + i + ".jpg";
yourFile = new File(directory, filename);
}
if (!yourFile.exists()){
if (directory.canWrite())
{
try {
FileOutputStream out = new FileOutputStream(yourFile, true);
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
out.flush();
out.close();
Toast.makeText(SecondMap.this, "File exported to /sdcard/Transit_Guide_Downloads/screenshot" + i + ".jpg", Toast.LENGTH_SHORT).show();
i++;
} catch (IOException e) {
e.printStackTrace();
}
}
}}
else
{
Toast.makeText(SecondMap.this, "SD Card not available!", Toast.LENGTH_SHORT).show();
}
}
에뮬레이터 또는 실제 장치에서 화면을 캡처하는 위치는 어디입니까? 장치를 확인 했으므로 정상적으로 작동합니다. – bjiang
내 실제 장치에 프로그램이 작동하지만지도 조각이 검정색으로 표시되어 있지 않습니다. –