adjustPan and adjustResize in nested fragment

爱⌒轻易说出口 提交于 2019-12-23 02:25:24

问题


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   |||
| ||       |||
| |└-------┘||
| └---------┘|
└------------┘

Issue is:

when I use adjustResize it allows me to scroll the fragment 3 ScrolView till end but when screen is too small, the ScrollView hides behind the SoftKeyboard and it does not push the parent fragments up to display fragment 3.

when I use adjustPan in small screens it pushes the the parent fragments up and allows me to see the 'fragment 3' but when I scroll, some of the ScrollView hides behind the soft keyboard.

I have done some reading in SO and android docs. they all point at using AdjustResize with ScrollView. but in my case i need to push the parent fragments up in small screens, otherwise the ScrollView in fragment3 will be covered by SoftKeyboard.

is it possible to do adjustPan in parent fragment and adjustResize for child fragment with scrollview at the same time ? if not is there any workarounds?

your helps are appreciated!


回答1:


Test "stateHidden|adjustResize" for parent activity.For me, It was the only way to over come a situation like yours



来源:https://stackoverflow.com/questions/45330600/adjustpan-and-adjustresize-in-nested-fragment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!