编写xml时android textinputLayout多余的空间

问题描述

我的TextInputLayout有问题 一旦我在其中写了文字,屏幕底部就会增加额外的空间。 即使在一行上书写,布局的高度也以某种方式增加。 它在中间的TextinputLayout上增加了空间(左侧和右侧工作正常)

enter image description here

我将主布局放置在蓝色背景中,并将高度设置为环绕内容,以查看我的子元素占用了额外的空间:

enter image description here

这是我的Xml:

<com.google.android.flexBox.FlexBoxLayout
        android:id="@+id/co2_set_point_comfort_mode_relative"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/nanosense"
        android:paddingBottom="8dp"
        app:justifyContent="space_between">

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/co2_comfort_min_layout"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            app:layout_flexGrow="1"
            app:helperText="ppm"
            android:hint="@string/min"
            app:startIconTint="@color/black"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/co2_comfort_min"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="numberDecimal"
                android:textSize="12sp"
                android:maxLength="4"
                android:digits="0123456789."/>
        </com.google.android.material.textfield.TextInputLayout>


        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/co2_set_point_comfort_mode_layout"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            app:startIconDrawable="@drawable/occupancy_in"
            app:helperText="ppm"
            app:layout_flexGrow="1.5"
            android:hint="@string/occupancy"
            android:layout_marginStart="8dp"
            app:startIconTint="@color/black"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/co2_set_point_comfort_mode"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="numberDecimal"
                android:maxLength="4"
                android:digits="0123456789."/>
        </com.google.android.material.textfield.TextInputLayout>


        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/co2_comfort_max_layout"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:layout_marginStart="8dp"
            app:layout_flexGrow="1"
            app:helperText="ppm"
            android:hint="@string/max"
            app:startIconTint="@color/black"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/co2_comfort_max"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="numberDecimal"
                android:textSize="12sp"
                android:maxLength="4"
                android:digits="0123456789."/>
        </com.google.android.material.textfield.TextInputLayout>

    </com.google.android.flexBox.FlexBoxLayout>

`

我可以将FlexbotLayout的高度设置为固定高度,但我想避免这种情况 你知道是什么问题吗? 预先谢谢你

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)