I have found a bug in Android. I have very basic layout.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.textfield.TextInputEditText
android:layout_margin="50dp"
android:layout_width="0dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I wanted to have on Focus black bottom border background. So I changed in themes.xml
<item name="colorSecondary">@color/black</item>
With this change when I press EditText/ TextInputEditText you can see small horizontal white lines next to it. Screenshot shows only left side, because I needed to zoom it.
What is causing the issue? This happens on S9+ and Pixel 4XL.
This is likely happening due to a combination of android:layout_margin="50dp"
and colorSecondary
. I don't think colorSecondary
is the intended attribute to change here.
Theming a TextInputLayout
is frustrating, butthis serves as excellent documentation . It states that you should override mtrl_textinput_default_box_stroke_color
in color.xml
You can also reference these similar customizations I made here:
https://github.com/gavingt/upcoming-games/blob/master/app/src/main/res/values/styles.xml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.