this project is a sample code to demonstrate an issue with using ScrollView (NestedScrollView) in ViewPager. the problem is similar to a wellknown bug AndroidBug5497.
the issue occors when I use a ViewPager and inside the first fragment of the ViewPager I have a another fragment that is parenting a sub fragment with ScrollView in it. to make it more visual:
┌------------┐
| 1 | 1 is the ViewPager fragment
| ┌---------┐|
| | 2 || 2 is the fragment inside ViewPager fragment
| |┌-------┐||
| ||3 ||| 3 is the sub fragment containing the ScrollView with EditText form
| ||form |||
| ||here |||
| || |||
| |└-------┘||
| └---------┘|
└------------┘
I have tested both AdjustPan
and AdjustResize
with adjustPan:
issue is that when the soft keybaord is open the view adjusts but the scroll view cannot scroll till the end of the view and some of the content remains behind the keyboard. this behaviour changes when I select the edit texts from bottom of the form. in that case, the fragment 1 (viewpager) and fragment 2(sub fragment) move up and allow the scroll view to be show even the last element.
with AdjustResize:
issue is that in small screens with less height. the entier fragment 3 with scrollview falls behind the soft keybaord.
I have attempted to use the wellknown Workaround on the web. for this issue. but hasn't been able to create a acceptable output using the workaround. there is also a copy of the AndroidBug5497Workaround in the repository.