How can I hide the EditText underbar (the prompt line with little serifs at the ends)?
There might be a better way to do what I want: I have a layout with an EditTe
if your edit text already has a background then you can use following.
android:textCursorDrawable="@null"
android:inputType="textVisiblePassword|textMultiLine" android:background="@android:color/transparent"
...its not the optimal solution but it works.
Set background to null.
android:background="@null"
You can do it programmatically using setBackgroundResource
:
editText.setBackgroundResource(android.R.color.transparent);
What I did was to create a Shape drawable and set that as the background:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:top="8dp"
android:bottom="8dp"
android:left="8dp"
android:right="8dp" />
<solid android:color="#fff" />
</shape>
Note: I actually used @dimen
and @color
values for the firelds, but I've simplified the shape file here for clarity.
You can set EditText
's backgroundTint
value to a specific color.
If you set transparent color, underbar should gone.
android:backgroundTint="@color/Transparent"
<color name="Transparent">#00000000</color>
But you can use this in Api v21(Lollipop)
or higher