我正在开发一个全屏模式的Android应用程序。当软键盘显示时,我希望屏幕能够自动调整。我使用ScrollView使我的屏幕可以扩展到大于最大高度。您可以查看下面的布局XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="${packageName}.${activityClass}" >
<VideoView
android:id="@+id/taskdetail_bgvideo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
<ScrollView
android:id="@+id/taskdetail_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Other Widgets -->
</LinearLayout>
</ScrollView>
</RelativeLayout>
背景中的VideoView放置在整体布局中,以创建背景视频。
我尝试了Android如何在软键盘可见时调整全屏模式下的布局中的解决方法,但在我的情况下,它并没有像预期的那样工作。当我选择最底部的TextView时,整个屏幕都被推向顶部,留下一个非常大的黑色区域,介于软键盘和活动屏幕之间。请查看下面的截图(抱歉,声望还很低,无法直接发布图片 :( )
所以你有没有可能的想法来解决这种奇怪的行为?此外,我还尝试了将softInputMode设置为ADJUST_RESIZE或ADJUST_PAN,两种设置都会这样做。当我将其设置为ADJUST_NOTHING时,什么也没有调整。
当我不使用上述解决方法时,我无法滚动视图到最底部的小部件,但窗口视图却被平移到了焦点TextView。我相信这实际上是主要的罪魁祸首,但我不知道该如何修复。
提前感谢 :)