Bal*_*oss 20 layout android android-edittext android-textinputlayout material-components-android
我需要删除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>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
Gab*_*tti 41
您可以应用app:boxStrokeWidth="0dp"和 app:boxStrokeWidthFocused="0dp"(或app:boxStrokeColor使用具有相同值的选择器的属性boxBackgroundColor)。
<com.google.android.material.textfield.TextInputLayout
app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"
...>
Run Code Online (Sandbox Code Playgroud)
对于没有背景和边框的白框:
<com.google.android.material.textfield.TextInputLayout
app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"
app:boxStrokeColor="#FFF"
app:boxBackgroundColor="#FFF"
...>
Run Code Online (Sandbox Code Playgroud)