我在 android lollipop 上遇到问题,当软键盘出现时屏幕不调整大小。
这是我进行的一项 Activity 中的 list 介绍示例:
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
是否添加了一些新的东西,我们必须考虑到 android 5.0? ScrollView 在 android < 5.0 上运行良好。
最佳答案
对于即使使用 android:fitsSystemWindows="true"
仍然有此问题的人在 ScrollView 中。
我找到了几种解决方法:
- 以根身份使用
fragment.xml
布局 RelativeLayour 并放置android:fitsSystemWindows="true"
里面。 ScrollView 用作 RelativeLayour 的子项。
<RelativeLayout android:fitsSystemWindows="true">
<ScrollView/>
</RelativeLayout>
- 使用 NestedScrollView 而不是 ScrollView。
这两个选项都应与 android:windowSoftInputMode="adjustResize"
一起使用并在 Android 5 上使用 <item name="android:windowTranslucentStatus">true</item>
工作旗帜。
`
关于Android - 在键盘启动时为 android 5.0 (lollipop) 调整 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27167176/