I used custom DragLinearLayout. All child I added using addDragView()
are draggable (user interaction).
I want to simulate Drag Event for clicked View (smooth move to the bottom of Layout).
ACTION_DOWN -> ACTION_MOVE -> ACTION_UP
I tried this code, but it didn't work.
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
float x = view.getLeft();
float y = view.getTop();
int metaState = 0;
MotionEvent downEvent = MotionEvent.obtain(
downTime,
eventTime + 1000,
MotionEvent.ACTION_DOWN,
x,
y,
metaState
);
view.dispatchTouchEvent(downEvent);
MotionEvent moveEvent = MotionEvent.obtain(
downTime,
eventTime + 1000,
MotionEvent.ACTION_MOVE,
x,
y + 300,
metaState
);
view.dispatchTouchEvent(moveEvent);
MotionEvent upEvent = MotionEvent.obtain(
downTime,
eventTime + 1001,
MotionEvent.ACTION_UP,
x,
y + 300,
metaState
);
view.dispatchTouchEvent(upEvent);