Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Shadow From AutoCompleteTextView Dropdown

I am trying to create a full width auto complete text field.

So far, I think I have the text field itself looking right. The problem is with the auto complete popup. It has this very bold shadow all around it and I just can't get rid of it.
Don't get me wrong, I still want the shadow, but a subtle shadow, only on the bottom of the popup, not all around it (especially not at the top, that's really weird).

Something like this: This is what I want.

Here's what mine looks like (sorry for giant image): What I have so far


The Code

activity_main.xml:

<AutoCompleteTextView
    android:id="@+id/actvSearch"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="8dp"
    android:background="@drawable/full_width_input"
    android:completionThreshold="1"
    android:hint="Search a movie..."
    android:textColorHint="#BDBDBD"
    android:elevation="0dp"
    android:popupBackground="@android:color/white" />

full_width_input.xml:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:top="-1dp" android:right="-1dp" android:left="-1dp">
        <shape android:shape="rectangle">
            <padding android:bottom="20dp" android:top="20dp" android:left="16dp" android:right="16dp" />
            <solid android:color="@android:color/white" />
            <stroke android:width="1dp" android:color="#E0E0E0" />
        </shape>
    </item>
</selector>
like image 589
Gofilord Avatar asked Jun 30 '15 10:06

Gofilord


1 Answers

use android:popupElevation="0"

<AutoCompleteTextView
    android:id="@+id/actvSearch"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="8dp"
    android:background="@drawable/full_width_input"
    android:completionThreshold="1"
    android:hint="Search a movie..."
    android:textColorHint="#BDBDBD"
    android:popupElevation="0dp"
    android:popupBackground="@android:color/white" />
like image 113
Abbath Avatar answered Oct 02 '22 02:10

Abbath