I have some views which I like to drag around. The views are within a LinearLayout, which itself is within a scrollview.
I want to get the position of the current finger (touch), to make a smooth scroll on my scrollview, depending of the height of the current drag.
I start my draggin after a long click with the View build-in listener startDrag
view.startDrag(null, shadowBuilder, view, 0);
I am also able to get the relativ position of the drag on the view that is currently hovered by
view.setOnDragListener(new OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
//get event positions
}
});
But this only works for the view where the drag shadow is currently on and DragEvent only provides relative positions, not raw positions.
What I need is the position of the finger, while the drag happens. Unfortunately all onTouchEvents get consumed while dragging.
Does anybody know how I get this to work?
Ps: One way that works (kind of) which I currently use, is to calculate the position of the touch via the dragEvent.relativePosition in combination with the view position. But isn't there a better way to go?