【发布时间】:2020-01-24 12:13:42
【问题描述】:
我需要删除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>
【问题讨论】:
-
你不需要这个 bg_textinput_layout 背景。只需使用 boxBackgroundColor 即可获得一个白框。
-
我将这种样式 Widget.MaterialComponents.TextInputLayout.OutlinedBox 应用于 textinputlayout,现在它正在工作
-
这里是简单的解决方案stackoverflow.com/questions/57063519/…
标签: android layout android-edittext android-textinputlayout material-components-android