Viatorus Viatorus - 1 year ago 78
Android Question

Android - Drag and Drop only vertical

I have got a textView or small Icon and I want to drag it only vertical.

What I tried:
Create an own ShadowBuilder but make him invisible. So others views get called over the OnDragListener but the ShadowView is not visible.

Instead I display an own view which is moved like here:
How to make the TextView drag in LinearLayout smooth, in android? with the different, only in vertical direction. The Problem is, the onTouchListener is only called twice if dragging is activated. So no moving could be done.

That solution does not work for me I think.
Drag an image only horizontally or vertically in android?

Maybe any idea? Thanks for reading.

Answer Source

try out my solution here, but only change the top&bottom margins instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download