저는 위 그림과 같이 확인을 클릭하면 그림판 부분만 캡쳐해서 SD 카드에 저장하고 싶습니다.

현재 문제는 가운데 그림을  그린 이미지만 저장하고 싶은데 화면 전체가 이미지로 저장된다는 것입니다. 

저는 addView를 사용해서 특정 레이아웃에서만 그림판이 동작하게 만들었습니다. 아마 여기서 문제인듯 싶습니다.ㅜㅜ


Draw.java

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        setContentView(R.layout.main);
        LinearLayout layout = (LinearLayout)findViewById(R.id.layout01);
        TextView text = (TextView)findViewById(R.id.textview01);
       
        vw = new MyView(this);  
        layout.addView(vw);
        arVertex = new ArrayList<Vertex>();


main.xml

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:background="#FFFFFF">

.
.

       <LinearLayout
       android:id="@+id/layout01"
          android:layout_width="fill_parent"
          android:layout_height="400px"
          android:layout_marginRight="10dip"
          android:layout_marginLeft="10dip"
          android:layout_marginTop="20dip"
          android:layout_marginBottom="40dip">      
      </LinearLayout>
.
.
      </LinearLayout>

이미지 파일을 생성하는 부분입니다.

      vw.getRootView().setDrawingCacheEnabled(true); // 캡쳐 할 수 있도록 권한 설정하는 부분
      
      vw.getRootView().buildDrawingCache();
      Bitmap srcimg = vw.getRootView().getDrawingCache();
      
      try {
       FileOutputStream out = new FileOutputStream("/sdcard/captureScreen.png");
       srcimg.compress(Bitmap.CompressFormat.PNG, 100, out);
      }catch (FileNotFoundException e){
       Log.d("FileNotFoundException :", "null");
      }


가운데 그림을 그린 부분만 캡쳐할 수 없을까요??? 도와 주세요.ㅠㅠ