수색…


Android Studio를 통해 스크린 샷 캡처

  1. Android 모니터 탭 열기
  2. 화면 캡처 단추를 클릭하십시오. Android Studio

Android Device Monitor를 통한 스크린 샷 캡처

  1. Android 기기 모니터 열기 ( 예 : C : <ANDROID_SDK_LOCATION> \ tools \ monitor.bat )
  2. 장치 선택
  3. 화면 캡처 단추를 클릭하십시오.

Android 기기 모니터

ADB를 통한 스크린 샷 캡처

아래의 예는 장치의 내부 저장 장치에 스크린 샷을 저장합니다.

adb shell screencap /sdcard/screen.png

캡처 ADB를 통한 스크린 샷과 PC에 직접 저장

Linux (또는 Cygwin이있는 Windows)를 사용하는 경우 다음을 실행할 수 있습니다.

adb shell screencap -p | sed 's/\r$//' > screenshot.png

특정보기의 스크린 샷 찍기

특정 View v 의 스크린 샷을 찍으려면 다음 코드를 사용할 수 있습니다.

Bitmap viewBitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.RGB_565);
Canvas viewCanvas = new Canvas(viewBitmap);
Drawable backgroundDrawable = v.getBackground();

if(backgroundDrawable != null){
    // Draw the background onto the canvas.
    backgroundDrawable.draw(viewCanvas);
}
else{
    viewCanvas.drawColor(Color.GREEN);
    // Draw the view onto the canvas.
    v.draw(viewCanvas) 
}

// Write the bitmap generated above into a file.
String fileStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
OutputStream outputStream = null;
try{
    imgFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), fileStamp + ".png");
    outputStream = new FileOutputStream(imgFile);
    viewBitmap.compress(Bitmap.CompressFormat.PNG, 40, outputStream);
    outputStream.close();
}
catch(Exception e){
    e.printStackTrace();
}


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow