Remove underline from AutoCompleteTextView via xml

giozh picture giozh · Apr 29, 2014 · Viewed 8.3k times · Source

i have this view:

<AutoCompleteTextView
        android:id="@+id/search_bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/rect_search"
        android:layout_alignLeft="@+id/rect_search"
        android:layout_alignRight="@+id/rect_search"
        android:layout_alignTop="@+id/rect_search"
        android:hint="@string/search_bar"
        android:textSize="20sp" />

as you can see, this view goes inside another view, rect_search, that is an ImageView. Now i've noticed that AutoCompleteTextView widget has a default underline on bottom, and i would remove it. It's possible?

Answer

Heisenberg picture Heisenberg · Apr 29, 2014

Just put:

android:background="@android:color/transparent"

inside your view.

EDIT: As @kiya said, nowadays is better to use

android:backgroundTint="@android:color/transparent"

As it maintains the view size.