Android: Make Autocompletetextview Dropdown Wrap To 2 Lines Or More
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 hav
Solution 1:
Wrap the TextView in a layout and use that for your ArrayAdapter
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent" ><TextViewandroid: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 = newArrayAdapter<String>(getActivity(), R.layout.list_item, R.id.item, COUNTRIES);
textView.setAdapter(adapter);
Post a Comment for "Android: Make Autocompletetextview Dropdown Wrap To 2 Lines Or More"