嵌套片段中的AdjustPan和AdjustResize [英] adjustPan and adjustResize in nested fragment

查看:261
本文介绍了嵌套片段中的AdjustPan和AdjustResize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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文档中做了一些阅读.它们都指向将AdjustResizeScrollView一起使用.但就我而言,我需要在较小的屏幕中将父片段向上推,否则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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆