Android:滚动视图中的视图被键盘隐藏

Android:滚动视图中的视图被键盘隐藏,android,Android,我创建了如上所述的布局。这里的问题是,当我点击编辑文本并弹出键盘时,滚动视图只会稍微拉伸,因此编辑文本会被键盘隐藏。按钮在关键字上方移动,但键盘隐藏的是两个编辑文本。将Scrollview保留为父项会使键盘打开时两个编辑文本都可见 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_widt

我创建了如上所述的布局。这里的问题是,当我点击编辑文本并弹出键盘时,滚动视图只会稍微拉伸,因此编辑文本会被键盘隐藏。按钮在关键字上方移动,但键盘隐藏的是两个编辑文本。

将Scrollview保留为父项会使键盘打开时两个编辑文本都可见

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <VideoView
                android:id="@+id/uploadedVideo"
                android:layout_width="match_parent"
                android:layout_height="224dp" />

            <TextView
                android:id="@+id/tvPath"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/uploadedVideo"
                android:padding="5dp"
                android:lines="1"
                android:hint="choose video"/>

            <EditText
                android:id="@+id/etTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/tvPath"
                android:hint="Your title here"/>

            <EditText
                android:id="@+id/etDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/etTitle"
                android:hint="Your description here"/>

            <Button
                android:id="@+id/btnUpload"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:text="upload"/>

        </RelativeLayout>

    </ScrollView>

</LinearLayout>

将Scrollview保留为父项会使键盘打开时两个编辑文本都可见

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <VideoView
                android:id="@+id/uploadedVideo"
                android:layout_width="match_parent"
                android:layout_height="224dp" />

            <TextView
                android:id="@+id/tvPath"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/uploadedVideo"
                android:padding="5dp"
                android:lines="1"
                android:hint="choose video"/>

            <EditText
                android:id="@+id/etTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/tvPath"
                android:hint="Your title here"/>

            <EditText
                android:id="@+id/etDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/etTitle"
                android:hint="Your description here"/>

            <Button
                android:id="@+id/btnUpload"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:text="upload"/>

        </RelativeLayout>

    </ScrollView>

</LinearLayout>