GestureOverlayView手势手势、GestureOverlayView

2023-09-06 18:01:42 作者:坟场嗨情歌

我在android的手势打。我想手势保存为图像。我发现有一个toBitmap方法手势转换为图像,但我不能得到它的工作。这里是我的code。我得到上toBitmap方法是未定义GestureOverlayView signature.toBitmap()行一个错误。我可以转换GestureOverlayView手势或有任何其他方式?

 最后按钮转换=(按钮)findViewById(R.id.convert);    convert.setOnClickListener(新OnClickListener(){        @覆盖        公共无效的onClick(视图v){            GestureOverlayView签名=(GestureOverlayView)findViewById(R.id.signature);            signature.toBitmap();            signature.clear(isChild());        }    }); 

解决方案

你试过存储的姿态,呼吁该toBitmap()方法,而不是试图储存一个位图关GestureOverlayView直接?

这可以看到在Android工具包样品中发现的姿态建设者示例应用程序。

GestureBuilderActivity.java:353

 最后的位图位= gesture.toBitmap(mThumbnailSize,mThumbnailSize,                            mThumbnailInset,mPathColor); 
事件处理机制之Gestures 手势

I am playing with gestures in android. I want to save gestures as images. I have found that there is a toBitmap method to convert gesture to image, but i can not get it working. Here is my code. I get an error on signature.toBitmap() line that toBitmap method is undefined for GestureOverlayView. Can i convert GestureOverlayView to Gesture or is there any other way??

  final Button convert = (Button) findViewById(R.id.convert);
    convert.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            GestureOverlayView signature = (GestureOverlayView) findViewById(R.id.signature);
            signature.toBitmap();
            signature.clear(isChild());
        }
    });

解决方案

Have you tried to store the gesture and call the toBitmap() method on that rather than trying to store a bitmap off the GestureOverlayView directly?

This can be seen in the gesture builder sample application found in the android toolkit samples.

GestureBuilderActivity.java:353

final Bitmap bitmap = gesture.toBitmap(mThumbnailSize, mThumbnailSize,
                            mThumbnailInset, mPathColor);