androidtextviewautocompletetextview

Remove underline from AutoCompleteTextView via xml


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?


Solution

  • 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.