I am writing an Android app that uses an AutoCompleteTextView just like the API example. The problem is that my text is too long and needs to wrap when the dropdown occurs. I
easy way :
adapter = new ArrayAdapter(getApplicationContext(), android.R.layout.two_line_list_item,android.R.id.text1,....);
android.R.layout.two_line_list_item this is easy change.
Wrap the TextView in a layout and use that for your ArrayAdapter
<?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" >
<TextView
android:id="@+id/item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp"
android:textColor="#000"
/>
</LinearLayout>
And the new calls for the ArrayAdapter
:
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.list_item, R.id.item, COUNTRIES);
textView.setAdapter(adapter);