本文介绍了GestureOverlayView手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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);

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

这篇关于GestureOverlayView手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 01:12