Search code examples
androidandroid-layoutandroid-scrollview

Scrollview inside of a scrollview


BEFORE YOU SAY "Google says not to do this" PLEASE READ ALL OF MY QUESTION!!

The layout:

ScrollView -> RelativeLayout -> ScrollView -> RelativeLayout

The first ScrollView is necessary because form entries pull up the soft keyboard on some phones which hides the rest of the content. Having a ScrollView as the outer most container allows a user to scroll with the soft keyboard present.

The second ScrollView lower on the hierarchy is a ListView which is still scrollable.

I completely understand why devs are discouraged to have a ScrollView within another ScrollView. I need to figure out a way to get the two to work together. I tried disabling the outermost ScrollView when the inner most ScrollView get's a touch, but that didn't help.

Is there a way to get around this to where both will work (not at the same time of course)? I wouldn't even mind disabling the outermost ScrollView until the content page is changed again. There has to be a way..


Solution

  • The answer is to programmatically intercept the touch events form the outer most scrollview. I am using a class that I found in another SOF about Disabling a ScrollView Programattically.