键盘调整大小会削减按钮的一部分

时间:2018-05-29 14:07:10

标签: android android-layout android-constraintlayout

我在滚动视图中有一个约束布局,AndroidManifest.xml中有“adjustResize”,因为我希望我的视图在用户点击编辑文本时调整大小。问题是,当我点击编辑文本(键盘打开)或者当我从键盘退出(按下后退按钮)时,有时(几乎随机)按钮被切断。这就是:

enter image description here

这是我的布局:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="50dp">

        <EditText
            android:id="@+id/editText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:theme="@style/EditTextStyleSendFunds"
            app:layout_constraintEnd_toStartOf="@+id/imageView2"
            app:layout_constraintHorizontal_bias="0.056"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:theme="@style/EditTextStyleSendFunds"
            app:layout_constraintEnd_toEndOf="@+id/editText3"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/editText3" />

        <EditText
            android:id="@+id/editText3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:theme="@style/EditTextStyleSendFunds"
            app:layout_constraintEnd_toStartOf="@+id/button"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/editText" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="31dp"
            android:layout_height="35dp"
            android:layout_marginEnd="8dp"
            android:layout_marginTop="32dp"
            app:layout_constraintEnd_toEndOf="@+id/spinner2"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@mipmap/ic_qrcode_grey600_24dp" />

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:layout_marginStart="24dp"
            android:layout_marginTop="32dp"
            android:background="@android:color/transparent"
            android:textAllCaps="false"
            android:textColor="@color/colorPrimary"
            app:layout_constraintEnd_toStartOf="@+id/spinner2"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/editText3"
            app:layout_constraintTop_toBottomOf="@+id/editText" />

        <Spinner
            android:id="@+id/spinner"
            android:layout_width="68dp"
            android:layout_height="27dp"
            android:layout_marginTop="48dp"
            app:layout_constraintEnd_toEndOf="@+id/spinner2"
            app:layout_constraintTop_toBottomOf="@+id/editText3" />

        <Spinner
            android:id="@+id/spinner2"
            android:layout_width="68dp"
            android:layout_height="27dp"
            android:layout_marginEnd="8dp"
            android:layout_marginTop="48dp"
            android:theme="@style/SpinnerSendFunds"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button"
            app:layout_constraintTop_toBottomOf="@+id/editText" />

        <Spinner
            android:id="@+id/spinner5"
            android:layout_width="0dp"
            android:layout_height="25dp"
            android:layout_marginBottom="8dp"
            android:layout_marginStart="8dp"
            android:theme="@style/SpinnerSendFunds"
            app:layout_constraintBottom_toBottomOf="@+id/editText5"
            app:layout_constraintEnd_toEndOf="@+id/spinner"
            app:layout_constraintHorizontal_bias="1.0"
            app:layout_constraintStart_toEndOf="@+id/editText5" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_marginTop="32dp"
            app:layout_constraintStart_toStartOf="@+id/editText4"
            app:layout_constraintTop_toBottomOf="@+id/editText4"
            app:srcCompat="@drawable/add" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginTop="32dp"
            android:background="@drawable/buttons2"
            android:text="SEND"
            android:textColor="@android:color/white"
            app:layout_constraintEnd_toEndOf="@+id/spinner5"
            app:layout_constraintTop_toBottomOf="@+id/spinner5" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            android:text="Add Additional Data"
            android:textColor="@color/colorPrimary"
            app:layout_constraintStart_toEndOf="@+id/imageView3"
            app:layout_constraintTop_toBottomOf="@+id/editText4" />

        <EditText
            android:id="@+id/editText4"
            android:layout_width="110dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:ems="10"
            android:inputType="number"
            android:theme="@style/EditTextStyleSendFunds"
            app:layout_constraintEnd_toEndOf="@+id/textView6"
            app:layout_constraintStart_toStartOf="@+id/textView6"
            app:layout_constraintTop_toBottomOf="@+id/textView6" />

        <EditText
            android:id="@+id/editText5"
            android:layout_width="113dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:ems="10"
            android:inputType="numberDecimal"
            android:theme="@style/EditTextStyleSendFunds"
            app:layout_constraintEnd_toEndOf="@+id/textView7"
            app:layout_constraintStart_toStartOf="@+id/textView7"
            app:layout_constraintTop_toBottomOf="@+id/textView7" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="110dp"
            android:layout_height="20dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            app:layout_constraintStart_toStartOf="@+id/editText2"
            app:layout_constraintTop_toBottomOf="@+id/editText2" />

        <TextView
            android:id="@+id/textView7"
            android:layout_width="110dp"
            android:layout_height="20dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="32dp"
            app:layout_constraintStart_toEndOf="@+id/textView6"
            app:layout_constraintTop_toBottomOf="@+id/editText2" />
    </android.support.constraint.ConstraintLayout>

</ScrollView>

0 个答案:

没有答案