我需要删除 TextInputLayout 的下划线。它几乎被移除,但在开始和结束时显示出很少的部分(黑色)。仅在激活时显示下面的屏幕
风格:
<style name="EditTextLoginRegister" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="boxCornerRadiusBottomEnd">8dp</item>
<item name="boxCornerRadiusBottomStart">8dp</item>
<item name="boxCornerRadiusTopEnd">8dp</item>
<item name="boxCornerRadiusTopStart">8dp</item>
<item name="boxStrokeWidth">0dp</item>
<item name="boxStrokeColor">@android:color/transparent</item>
<item name="boxBackgroundColor">@color/grey</item>
<item name="android:textColorHint">@color/greyLight2</item>
<item name="startIconTint">@color/greyLight2</item>
<item name="endIconTint">@color/greyLight2</item>
<item name="hintTextColor">@color/violet</item>
</style>
和 TextInputLayout:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tl_email_login"
style="@style/EditTextLoginRegister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:hint="@string/e_mail"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_header_login"
app:startIconDrawable="@drawable/ic_user">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_email_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:textColor="@color/greyLight" />
</com.google.android.material.textfield.TextInputLayout>
最佳答案
尝试将 boxStrokeWidthFocused
添加到您的样式
<style name="EditTextLoginRegister" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<!-- Other attributes -->
<item name="boxStrokeWidthFocused">0dp</item>
</style>
不可否认,这是最困难的部分 -> 造型 Material 设计 View 。
在 Android Studio 中,可以获得 AutoComplete
选项,我通常会浏览完整列表并尝试各种项目。
关于android - 删除编辑文本指示器(下划线)-Material Design,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63897999/