Dispatch a scroll event from listview to scrollview - android

I have a ListView in which every row contains the following
-2 images
-1 textview
-1 scrollview that will display a bunch of tags
I searched the internet and I found out that is really hard to dispatch the scroll event from a listview to it's children, especially when they scroll on the same axis.
I was thinking if there is a possibility to find out if the touch event was on the scrollview and if it is, then I should dispatch the scroll event, else I will scroll the list.
Do you have any ideas how can I implement that?
EDIT:
I tried to to override the onTouchEvent method from the ListView but It doesn't work. When I drag over the scroll view the content disappears and when I scroll the listview, the content of the scroll view remains smudged on the screen.
Any ideas?

Related

ListView scroll to coordinates

I need to scroll list view to some point (e.g. I need to scroll 250px)
I tried next code
container.setAdapter(crewAdapter);
container.scrollTo(0, scroll);
So now it looks good. But when I start scroll by touch scrollview 'jump' to 0 and scroll by finger from top. How to solve it?

Scrollview jumps/repositions when trying to scroll on a clickable child of it

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?
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.

Transferring touch event back to parent

I have a ListView inside a ScrollView. I know I can intercept the touch events using the onInterceptTouchEvent method in the ScrollView. But once the child, i.e. ListView, starts consuming the touch event, onInterceptTouchEvent is not call. My problem is how can I transfer the touch event back to parent(i.e. ScrollView) once the ListView scroll has reached top. I want the scroll to be in continuation.
Suppose I'm scrolling the ListView and have reached the top of the ListView I want the scroll to continue so that I can scroll the parent, i.e. ScrollView. How can I achieve this?
You can check whether you are at the top of the listview, then return false from the touch event.

can we make horizontal scroll view infinte or loop around

I want to make horizontal scroll view infinite or atleast give the effect of being infinite.
Any idea how to do so?
can we listen to android horizontal scroll view as to when screen is scrolled.Is there any callback method that is called?
Can we know if the end of scroll has been reached?

ViewPager in a ListView - how to lock the scrolling axis?

I have a ViewPager widget in every row of a ListView. This provides a shelf-like UI, so the user can scroll around searching for a shelf vertically, and then scroll horizontally amongst the contents of a shelf. This works.
But the scrolling experience is terrible: if I start to drag a shelf's ViewPager, scroll it horizontally, and accidentally drag a bit upwards/downwards, then the ListView "traps" this dragging action, and start to scroll vertically, ending my horizontal drag. In this state, the drag action won't "return" to the ViewPager, the ListView has it, and that's it. I have to start another drag action to affect the ViewPager again. So I guess the ListView has precedence in these cases.
How can this be fixed? I'd like to achieve the exact opposite: If the ViewPager inside a list row starts reacting to a horizontal drag, then it should trap that action, and this drag should stop affecting the ListView, no matter how the user moves his/her finger vertically. Can this be done?
I've found a solution in this thread. There the problem is to handle touch events properly for a HorizontalScrollView inside a regular ScrollView, but the solution to that problem seems to apply to this one too.

Categories

Resources