2011-05-16 23 views
0

我如何設置圖像作爲我的autocomlete列表的背景?在自動完成視圖中設置背景android

<?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); 

謝謝

回答

1

在XML把背景屬性爲您的TextView:

<TextView android:background="@drawable/your_img" ... other attributes /> 
+0

我想設置包含textview的頁面的背景....沒有下拉列表的背景。 – magemello 2011-05-16 22:26:04

+0

我不明白你在做什麼?如果你想改變TextView的背景,按照我在答案中指出的方式進行,如果你想改變別的東西的背景,那麼設置另一個視圖的android:background屬性。試着更好地澄清你的問題? – Gix 2011-05-16 23:00:20

+0

你從來沒有在android中使用autocomoplete texview? – magemello 2011-05-16 23:24:32

0

這可能幫助別人..我想你要找的是這樣的:

textView.setDropDownBackgroundResource(); 

searchBox.setDropDownBackgroundDrawable();