Android Surface视图无休止地滚动

时间:2016-08-14 20:36:28

标签: android surfaceview surfaceholder

我在图像视图中放置了一个图像视图。代码

if (holder != null) {
            canvas = holder.lockCanvas();
            if (canvas != null) {
                canvas.drawColor(-1);
                canvas.save();
        canvas.setMatrix(currentMatrix);
        if (image != null) {
            canvas.drawPicture(image);
        }
        canvas.restore();
                holder.unlockCanvasAndPost(canvas);
            }
        }

我已为图像添加了缩放和缩放。但在imageview完成后滚动时,曲面仍在滚动

如何避免无尽的卷轴?在Scroll的代码段下面

case MotionEvent.ACTION_MOVE:
                switch (currentTouchState) {
                    case MapView.TOUCH_STATE_SCROLL:
                        currentMatrix.set(saveMatrix);
                        currentMatrix.postTranslate(event.getX() - startTouch.x, event.getY() -
                                startTouch.y);
                        refresh();
                        break;

0 个答案:

没有答案