Android: AutoCompleteTextView maximum margin in ListView

AutoCompleteTextView displays a ListView in a popup for automatic completion. Attached is an image detailing the problem. Just before the first point, there is a small supply of white. This stock is displayed only at the top of the list. This problem is observed on device 2.3, but on 4.x this problem is not visible.

enter image description here

Can someone indicate the reason for this behavior and the way to fix it.

Layout Code Containing AutoCompleteTextview

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingLeft="8dp" android:paddingRight="8dp" android:layout_height="wrap_content" android:layout_width="match_parent"> <AutoCompleteTextView android:id="@+id/menu_search_field" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/textfield_searchview_holo_light" android:clickable="true" android:hint="@string/search_hint" android:imeOptions="actionSearch" android:lines="1" android:singleLine="true" android:textColor="@color/header_text_color" android:textColorHint="@color/header_hint_text_color" android:textSize="14dip"/> </LinearLayout> 

Layout defining an item in a Listview.

 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp" android:textSize="16sp" android:textColor="@android:color/white" android:background="@android:color/black" android:ellipsize="end" > </TextView> 

And available for textfield_searchview_holo_light

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@drawable/textfield_search_default_holo_dark" /> <item android:drawable="@drawable/textfield_search_default_holo_dark" /> </selector> 

Thanks.

+4
source share
1 answer

Try adding the XML attribute to your AutoCompleteTextView:

 android:popupBackground="color_what_you_want_to_background" 

in your case something like

 android:popupBackground="@android:color/black" 

Hope this helps you

0
source

All Articles