嵌套片段中的AdjustPan和AdjustResize [英] adjustPan and adjustResize in nested fragment
问题描述
我使用ViewPager,并且在ViewPager的第一个片段内有另一个片段,该片段将带有ScrollView的子片段作为父对象.使其更具视觉效果:
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 |||
| || |||
| |└-------┘||
| └---------┘|
└------------┘
问题是:
当我使用adjustResize
时,它允许我滚动片段3 ScrolView
直到结束,但是当屏幕太小时,ScrollView
会隐藏在SoftKeyboard
后面,并且不会将父片段向上推来显示片段3.
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.
当我在小屏幕上使用adjustPan
时,它会将父级片段向上推,并允许我看到片段3",但是当我滚动时,某些ScrollView
隐藏在软键盘后面.
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.
我已经在SO
和android文档中做了一些阅读.它们都指向将AdjustResize
与ScrollView
一起使用.但就我而言,我需要在较小的屏幕中将父片段向上推,否则fragment3中的ScrollView
将被SoftKeyboard
覆盖.
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
.
是否可以同时使用滚动视图在父片段中进行adjustPan和为子片段进行adjustResize?如果没有解决方法?
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?
我们非常感谢您的帮助!
推荐答案
测试"stateHidden|adjustResize"
家长活动.对我来说,这是克服类似情况的唯一方法
Test "stateHidden|adjustResize"
for parent activity.For me, It was the only way to over come a situation like yours
这篇关于嵌套片段中的AdjustPan和AdjustResize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!