Android Question Scrollview within a Scrollview?

DrownedBat

Member
Licensed User
Longtime User
Good morning all!
Back at it and I'm experimenting with Scrollviews. I have one a Scrollview within another Scrollview and although the panel seems to be set to the proper height and .BringtoFront has been called, the second one doesn't want to scroll. What am I missing here?

Thanks!
 

barx

Well-Known Member
Licensed User
Longtime User

The fact that you shouldn't put 1 scrollable view within another...
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Shouldn't or can't?

I think you have already proven that you 'can', because you have, but you shouldn't because it doesn't work. One of the views consumes the scroll event and therefore the other is unresponsive to that same action.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
there is a work around, i do not know if it is posible to adapt to B4A

you must use gesturedetector.

set the gesture detector to the inner scroll view and use the reflection library like this (on the event of touch of the inner scroll)

B4X:
Dim r As Reflector
r.Target = parentscrollview
r.RunMethod2("requestDisallowInterceptTouchEvent", True, "java.lang.boolean")

i use it once for a draggable view within a scrollview and worked so i do not really now if it will work for 2 scrollviews.
 
Upvote 0

DrownedBat

Member
Licensed User
Longtime User
No luck with this method as yet. The gesturedetector registers a Scroll event only when the scrollview's panel is touched, but not when any loaded views within the panel are (might need to link these). I'll have to try something else with the layout then. Thanks for the help!
 
Upvote 0

DrownedBat

Member
Licensed User
Longtime User
Well the bypass does indeed work, it just needs some adjusting. The gesturedetector's scroll event only registers horizontal scrolling and I've had no luck with fling. It works when I first scroll the second scrollview horizontally to trigger the by pass and then scroll vertically. Obviously needs some adjusting but the bypass works. Thanks Enrique Gonzalez R!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…