使用scrollview时,键盘会隐藏Edittext

时间:2019-08-30 07:04:39

标签: android keyboard scrollview

我有一个简单的注册表单,其中有多个字段,我在scrollview中使用linearLayout。问题是,单击编辑文本后弹出键盘时,某些字段隐藏在其后面,并且不滚动

我尝试了android:windowSoftInputMode =“ adjustResize”和“ adjustPan”,但对我没有帮助

这是我的signup.xml代码

<< / p>

<RelativeLayout
    android:id="@+id/signUpProgressRl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:alpha="0.7"
    android:background="@color/colorBlack"
    android:elevation="@dimen/_1sdp"
    android:visibility="gone">

    <ProgressBar
        android:layout_width="@dimen/_100sdp"
        android:layout_height="@dimen/_100sdp"
        android:layout_centerInParent="true" />
</RelativeLayout>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_10sdp"
        android:layout_marginEnd="@dimen/_10sdp"
        android:orientation="vertical">


        <ImageView
            android:layout_width="@dimen/_50sdp"
            android:layout_height="@dimen/_50sdp"
            android:layout_gravity="center_horizontal"
            android:src="@drawable/ic_signup"
            android:layout_marginTop="@dimen/_10sdp"
            android:tint="#FFFFFF" />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Sign Up"
            android:textColor="@color/colorWhite"
            android:textSize="@dimen/_25sdp"
            android:textStyle="bold" />

        <View
            android:layout_width="@dimen/_80sdp"

            android:layout_height="@dimen/_1sdp"
            android:layout_gravity="center"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@color/colorMain1" />


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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/cruise_plan_border"
                android:orientation="vertical"
                android:padding="@dimen/_10sdp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="You are:"
                    android:textColor="@color/colorWhite"
                    android:textSize="@dimen/_15sdp"
                    android:textStyle="bold" />

                <Spinner
                    android:id="@+id/cruisePlanSpinner"
                    style="@style/SpinnerTheme"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_30sdp"
                    android:layout_marginTop="@dimen/_10sdp"
                    android:background="@drawable/spinner_bg" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_10sdp"
                    android:text="How do you travel?"
                    android:textColor="@color/colorWhite"
                    android:textSize="@dimen/_15sdp"
                    android:textStyle="bold" />

                <Spinner
                    android:id="@+id/howDoYouTravelSpinner"
                    style="@style/SpinnerTheme"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_30sdp"
                    android:layout_marginTop="@dimen/_10sdp"
                    android:layout_marginBottom="@dimen/_10sdp"
                    android:background="@drawable/spinner_bg" />


            </LinearLayout>

            <EditText
                android:id="@+id/signupEmailField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Email"

                android:inputType="textEmailAddress"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupPasswordField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Password"
                android:inputType="textPassword"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />

            <EditText
                android:id="@+id/signupConfirmPasswordField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Confirm password"
                android:inputType="textPassword"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupRealNameField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Real name"
                android:inputType="text"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupHowManyAdultField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Number of adults"
                android:inputType="text"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />

            <EditText
                android:id="@+id/signupHowManyChildrenField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Number of children"
                android:inputType="text"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupAgeOfChildrenField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Age of children"
                android:inputType="text"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupDescriptionField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_80sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:gravity="start"
                android:hint="Description"
                android:inputType="text|textMultiLine"
                android:paddingStart="@dimen/_10sdp"
                android:paddingTop="@dimen/_10sdp"
                android:paddingEnd="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupWhatsappNumberField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="WhatsappNumber"
                android:inputType="numberSigned"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupSkypeIdField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Skype Id"
                android:inputType="textUri"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupWebsiteField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Website Url"
                android:inputType="textUri"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <EditText
                android:id="@+id/signupBlogUrlField"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@drawable/round_corners_field"
                android:backgroundTint="@color/colorWhite"
                android:hint="Blog Url"
                android:inputType="textUri"
                android:paddingStart="@dimen/_10sdp"
                android:textColor="@color/colorBlack"
                android:textColorHint="@color/colorBlack"
                android:textSize="@dimen/_10sdp" />


            <android.support.v7.widget.AppCompatButton
                android:id="@+id/btn_signup"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_20sdp"
                android:layout_marginBottom="24dp"
                android:background="@color/colorMain1"
                android:drawableEnd="@drawable/ic_right"
                android:padding="12dp"
                android:paddingEnd="@dimen/_10sdp"
                android:text="Next"
                android:textColor="#FFFFFF"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/link_signin"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="24dp"
                android:gravity="center"
                android:text="Already have an account? Sign in"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/_12sdp" />
        </LinearLayout>
    </LinearLayout>

</ScrollView>

0 个答案:

没有答案