android 点击图片移动缩放图片

public boolean onTouch(View v, MotionEvent event) {
int x = (int) event.getX();
int y = (int) event.getY();

            switch (event.getAction()){
                case MotionEvent.ACTION_DOWN:
                    move_x_old = x;
                    move_y_old = y;
                    break;
                case MotionEvent.ACTION_MOVE:

                        int moveX = x - move_x_old;
                        int moveY = y - move_y_old;

                        int i = 0;
                        if (moveX < 0 && moveY > 0) {
                            i = moveX;
                        } else if (moveX > 0 && moveY < 0) {
                            i = y;
                        } else if (moveX < 0 && moveY < 0) {
                            i = Math.abs(moveX) > Math.abs(moveY) ? moveX : moveY;
                        } else {
                            i = Math.max(moveX, moveY);
                        }

// if(moveX // i = Math.abs(x) > Math.abs(y) ? moveX : moveY;
// }else if(moveX0){
// i=
// }

                        ViewGroup.LayoutParams layoutParams = getLayoutParams();
                        layoutParams.width += i ;
                        layoutParams.height += i ;
                    Log.e("onTouch", "onTouch:"+i+" "+x+" "+y+" "+move_x_old+" "+move_y_old+" "+moveX+" "+moveY);
                        if (layoutParams.width < metric.widthPixels / (float) 10
                        /*|| layoutParams.height < metric.heightPixels / (float)10*/) {
                            layoutParams.width = (int) (metric.widthPixels / (float) 10);
                            layoutParams.height = layoutParams.width + (ItemHeight - ItemWidth);
                        } else if (layoutParams.width > metric.widthPixels * ((float) 3 / 4)
                        /*|| layoutParams.height > metric.heightPixels * ((float)3 / 4)*/) {
                            layoutParams.width = (int) (metric.widthPixels * ((float) 3 / 4));
                            layoutParams.height = layoutParams.width + (ItemHeight - ItemWidth);
                        }
                        setLayoutParams(layoutParams);

// move_x_old = x;
// move_y_old = y;
break;
case MotionEvent.ACTION_UP:
move_x_old = 0;
move_y_old = 0;

                    buttonBean.setX((float) getLeft() / (float) metric.widthPixels);
                    buttonBean.setY((float) getTop() / (float) metric.heightPixels);
                    buttonBean.setWidth(getWidth());
                    buttonBean.setHeight(getHeight());

                    break;
            }


            return true;
        }

图片可以缩放,但是会抖动,有什么解决办法吗。输出日志显示,位移谝量是负的

http://www.cnblogs.com/linjzong/p/4211661.html