출처: http://itmir.tistory.com/548



private float mTouchX, mTouchY;
private int mViewX, mViewY;
 
private OnTouchListener mViewTouchListener = new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
 
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
 
            mTouchX = event.getRawX();
            mTouchY = event.getRawY();
            mViewX = mParams.x;
            mViewY = mParams.y;
 
            break;
 
        case MotionEvent.ACTION_UP:
            break;
 
        case MotionEvent.ACTION_MOVE:
            int x = (int) (event.getRawX() - mTouchX);
            int y = (int) (event.getRawY() - mTouchY);
 
            mParams.x = mViewX + x;
            mParams.y = mViewY + y;
 
            mManager.updateViewLayout(mView, mParams);
 
            break;
        }
 
        return true;
    }
};


+ Recent posts