Search code examples
javaandroidautocompletetextview

AutoCompleteTextView items' text not visible


I'm loading an AutoCompleteTextView with lots of items but none of them is shown/visible in the popup.

P.s.: If I click somewhere in that empty white view, the text appears in the AutoCompleteTextView (it's white text)

resource.xml

<AutoCompleteTextView
            android:id="@+id/reg_city"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@color/input_register_bg"
            android:hint="Città"
            android:padding="10dp"
            android:singleLine="true"
            android:textColor="@color/input_register"
            android:textColorHint="@color/input_register_hint" />

activity.java

    ArrayAdapter<String> citta_adapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, list_cities);
    in_city.setAdapter(citta_adapter);

Solution

  • Most probably the suggestions are white-on-white, which is why you're not seeing them, but pressing on a suggestion works.

    See this for a list of possible solutions: AutoCompleteTextview Color set white by default