2016-08-20 3 views
1

내 활동에서 스크롤보기를 사용하고 있습니다. 전체 활동 화면을 공유하고 싶지만 할 수 없습니다. 볼 수있는 부분을 공유 할 수 있습니다. 화면하지만 전체 활동 화면이 아닙니다. 전체 활동의 스크린 샷을 찍을 수 있습니다. 이처럼 시도했지만 활동의 보이는 부분 만 공유합니다. .Plz 나를 도와주세요.Android에서 활동 화면의 전체보기를 캡처하는 방법

ShareImageView.setOnClickListener(new OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      // TODO Auto-generated method stub 

      //View v1 = getWindow().getDecorView(); 

       View v1 = findViewById(android.R.id.content); 

      v1.setDrawingCacheEnabled(true); 
      myBitmap = v1.getDrawingCache(); 
      saveBitmap(myBitmap); 


     } 

    }); 

은 스크린 샷 촬영 저장이 ::

public void saveBitmap(Bitmap bitmap) { 
    String filePath = Environment.getExternalStorageDirectory() 
    + File.separator + "Pictures/screencapture.png"; 
    File imagePath = new File(filePath); 
    FileOutputStream fos; 
    try { 
    fos = new FileOutputStream(imagePath); 
    bitmap.compress(CompressFormat.PNG, 100, fos); 
    fos.flush(); 
    fos.close(); 
    share(filePath); 
    } catch (FileNotFoundException e) { 
    Log.e("exception1", e.getMessage(), e); 
    } catch (IOException e) { 
    Log.e("exception2", e.getMessage(), e); 
    } 
    } 
,

답변

0
try this: 

    public static Bitmap loadBitmapFromView(View v, int width, int height) { 
Bitmap b = Bitmap.createBitmap(width , height, Bitmap.Config.ARGB_8888);     
Canvas c = new Canvas(b); 
v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); 
v.draw(c); 
return b; 

}까지 화면의 높이와 폭을 전달해야 할 화면의 화면 크기 method.depending시에 사용되는 높이와 폭을 가진 혼란

+0

하고 있습니다. @ Anantham –

+0

view.getWidth() 및 view.getHeight @ Gauravsingh – YUVRAJ

+0

그것의 작동하지만 여전히 보이는 영역의 스냅 샷을 복용하지 전체 활동 화면 shot.Any 전체 화면을 캡처하는 다른 방법 @Anantham –