将手势保存为位图

时间:2011-04-12 04:06:45

标签: android gesture

我只是想知道我是否可以从布局中将Gestures保存为android中的位图。我之前曾问过类似的question但从未得到过回复

请帮忙......

谢谢

2 个答案:

答案 0 :(得分:1)

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

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();

答案 1 :(得分:0)

我计划做同样的事情,但还没有实施。我注意到有一个Guesture.toBitmap()方法,如果按照宣传的方式工作,它就像是票证。

请参阅http://developer.android.com/reference/android/gesture/Gesture.html#toBitmap%28int,%20int,%20int,%20int,%20int%29