0

I am using two (embedded) ScrollViews like suggested here, in order to create a '2D Scrollview'.

I add multiple childs to this view, and to some of them I set OnClickListener (I also tried with OnLongClickListener as well).

Functionally the result is what I have expected, although if I try to scroll (starting from a child, that has either of the listeners), the scrollview jumps/repositions to the ~opposite direction, I started the scroll to. So if I scroll like this e.g. upwards, the view jumps a big downwards so that I can scroll up at most to the original position.

I have been trying to play around with calling setFocusable(false) on the childs and setFocusable(true) on the ScrollView(s) (but also tried different permutations of it, as I am not sure about setFocusable()), but couldn't really get on top of it.. Any suggestions?

Community
  • 1
  • 1
meztelentsiga
  • 171
  • 1
  • 10

1 Answers1

2

Just encase you are still wondering this is happening because when you start scrolling the other scroll view, ACTION_CANCEL is posted to the on touch method of the original ScrollView which causes a default scroll view to jump back to its original position.

Austi01101110
  • 616
  • 4
  • 23
  • Sorry for my late reply, and thanks for your comment. Now as I came back to this question, I debugged the scrollviews in question, but ACTION_CANCEL is never posted. Instead ACTION_MASK is posted first (two times), and than ACTION_UP. Any ideas? – meztelentsiga Nov 22 '15 at 10:20