简体   繁体   English

Android TextInputLayout 删除edittext下方的额外空间

[英]Android TextInputLayout remove extra space below edittext

I'm using TextInputLayout.FilledBox.Dense as style for my TextInputLayout and then I disable the hint by adding hintEnabled=false but then It adds extra line at the bottom of EditText我使用TextInputLayout.FilledBox.Dense作为我的TextInputLayout样式,然后我通过添加hintEnabled=false禁用了提示,但它在EditText的底部添加了额外的行

Code snippet代码片段

<android.support.design.widget.TextInputLayout
            android:id="@+id/name_text_input"
          style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:hintAnimationEnabled="false"
            app:hintEnabled="false">

            <EditText
                android:id="@+id/login_tab_userid3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:imeOptions="actionNext"
                android:inputType="textPersonName" />

        </android.support.design.widget.TextInputLayout>

Screenshot截屏

截屏

You can remove the line below the your EditText from this android:background="@null" and then creating the View below your EditText for creating the line below the EditText您可以从此android:background="@null"删除EditText下方的行,然后在EditText下方创建View以创建EditText下方的行

            <EditText
                android:layout_width="match_parent"
                android:background="@null"
                android:layout_height="wrap_content" />

            <View
                android:layout_width="match_parent"
                android:background="@android:color/white"
                android:layout_height="0.5dp"/>

In your editText在您的编辑文本中

Put this line : android:background="@null"把这一行: android:background="@null"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM