Android 将手势保存为位图

Android 将手势保存为位图,android,gesture,Android,Gesture,我只是想知道我是否可以在android中从布局中将手势保存为位图。我以前也问过类似的问题,但一直没有得到答复 请帮忙 谢谢我也有同样的计划,但还没有实施。我确实注意到有一个Guesture.toBitmap()方法,如果按照广告的方式工作,它看起来就像是一张票 请参见我们可以将手势保存为位图 GestureOverlayView gestureView = (GestureOverlayView) findViewById(R.id.gestures); gestureView.

我只是想知道我是否可以在android中从布局中将手势保存为位图。我以前也问过类似的问题,但一直没有得到答复

请帮忙


谢谢

我也有同样的计划,但还没有实施。我确实注意到有一个Guesture.toBitmap()方法,如果按照广告的方式工作,它看起来就像是一张票


请参见

我们可以将手势保存为位图

GestureOverlayView gestureView = (GestureOverlayView) findViewById(R.id.gestures);
        gestureView.setDrawingCacheEnabled(true);
        Bitmap bm = Bitmap.createBitmap(gestureView.getDrawingCache());
        File f = new File(Environment.getExternalStorageDirectory()
                + File.separator + "signature.png");
        f.createNewFile();
        FileOutputStream os = new FileOutputStream(f);
        os = new FileOutputStream(f);
        //compress to specified format (PNG), quality - which is ignored for PNG, and out stream
        bm.compress(Bitmap.CompressFormat.PNG, 100, os);
        os.close();