从TextInputEditText中删除底线 [英] Remove bottom line from TextInputEditText

本文介绍了从TextInputEditText中删除底线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除TextInputEditText的底线我将背景设置为透明和空,但都不起作用。

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg_textinput_layout"
    android:hint="@string/app_name">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/transparent"/>

</com.google.android.material.textfield.TextInputLayout>

BG_TextInput_Layout

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@color/white"/>

<stroke android:width="@dimen/spacing_1"
    android:color="@color/hint_text_color"/>
</shape>

推荐答案

您可以应用<[2-1]app:boxStrokeWidthFocused="0dp"(或使用具有与boxBackgroundColor相同值的选择器的app:boxStrokeColor属性)。

   <com.google.android.material.textfield.TextInputLayout
       app:boxStrokeWidth="0dp"
       app:boxStrokeWidthFocused="0dp"
       ...>

对于没有背景和边框的白色框:

<com.google.android.material.textfield.TextInputLayout
    app:boxStrokeWidth="0dp"
    app:boxStrokeWidthFocused="0dp"
    app:boxStrokeColor="#FFF"
    app:boxBackgroundColor="#FFF"
    ...>

这篇关于从TextInputEditText中删除底线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆