如何将图像设置为自动组合列表的背景?
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp"
android:textColor="#000">
</TextView>
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_friends);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, friendsListNameOrder);
textView.setAdapter(adapter);
谢谢
在 xml 中放置 TextView 的背景属性:
<TextView android:background="@drawable/your_img" ... other attributes />
这可能会
帮助其他人..我想你要找的是这个:
textView.setDropDownBackgroundResource();
或
searchBox.setDropDownBackgroundDrawable();