Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android AutoCompleteTextView suggestions overlapping the TextView

I am making an application using Google maps. I am using AutoCompleteTextView to get suggestions of places. The output is as follows :

enter image description here

As you can see from the image, the border of the suggestion box is overlapping the TextView. I am using custom item layout with a Textview inside a Linear Layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#fff"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/resultValue"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#fff"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:textColor="#474040"
        android:textSize="15sp" />

</LinearLayout>

Is there a way to bring the suggestion window down and to remove or change the colour of the grayish border of the suggestion window ?

like image 644
Aditya Pawade Avatar asked Mar 22 '23 23:03

Aditya Pawade


2 Answers

Was doing the same thing as in the accepted answer, but was still having the overlap issue. To fix that make this call:

autocompleteView.setDropDownVerticalOffset(0);
like image 180
Dennis K Avatar answered Apr 07 '23 01:04

Dennis K


Try like this, android:popupBackground="#EFEEEC"// change according your border you want for the suggestion box

<AutoCompleteTextView
            android:id="@+id/autocomplete"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/text_area"
            android:inputType="text|textNoSuggestions|textMultiLine"
            android:paddingLeft="10dp"
            android:popupBackground="#EFEEEC"
            android:textColor="#333333"
            android:textColorHint="#9c9c9c"
            android:textSize="18sp"
            android:completionThreshold="1" />

and auto_textview.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="12dp"
    android:textColor="#333333"
    android:layout_margin="15dp"
    android:textSize="16sp" >
</TextView>

text_area9.png

enter image description here

Final output will look like

enter image description here

Hope this help you.

like image 38
Amit Gupta Avatar answered Apr 07 '23 01:04

Amit Gupta