键盘弹出时按钮未向上滚动

时间:2018-06-28 16:15:12

标签: android

弹出键盘时,按钮没有向上滚动。 我已经尝试过了:

android:windowSoftInputMode="adjustPan|adjustResize".

我认为问题出在XML。当我们单击编辑文本时,键盘会弹出,并且我希望按钮应该在键盘上方。请帮助我查看XML代码。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorWhite"
    android:fillViewport="true"
    android:fitsSystemWindows="true"
    android:isScrollContainer="false">

    <RelativeLayout
        android:id="@+id/rlLogin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:fitsSystemWindows="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/ivLogo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/min_dp"
                android:layout_marginStart="@dimen/min_dp"
                android:layout_marginTop="@dimen/min_dp"
                android:keepScreenOn="true"
                android:src="@mipmap/ic_align_splash" />


            <TextView
                android:id="@+id/textView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/min_dp"
                android:layout_marginStart="@dimen/min_dp"
                android:layout_marginTop="@dimen/size_xl1"
                android:text="@string/title_enter_email"
                android:textSize="14sp" />

            <EditText
                android:id="@+id/etEmail"
                style="@style/EditInput"
                android:layout_marginTop="@dimen/size_s1"
                android:hint="@string/hint_email"
                android:inputType="textWebEmailAddress" />

            <Button
                android:id="@+id/btnNext"
                style="@style/Button"
                android:layout_marginTop="@dimen/min_dp"
                android:text="@string/title_button_next" />

        </LinearLayout>

        <RelativeLayout
            android:id="@+id/rlLogo"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/colorWhite"
            android:elevation="@dimen/size_s1"
            android:visibility="gone">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:src="@mipmap/ic_align_splash" />
        </RelativeLayout>

        <include
            android:id="@+id/progressBar"
            layout="@layout/progress_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_gravity="bottom" />
    </RelativeLayout>
</ScrollView>

1 个答案:

答案 0 :(得分:0)

尝试在相同的父布局下添加按钮和ScrollView。 例如:

<RelativeLayout>
      <ScrollView...../>
      <Button/>
<RelativeLayout/>
相关问题