2011-09-20 31 views
0

嗨我想爲我的微調對話框設置背景。我使用下面的代碼如何設置微調對話框的背景

<Spinner android:id="@+id/my_ac_debt_card_spinner" 
     android:layout_toRightOf="@+id/my_ac_debt_card_text" android:entries="@array/my_ac_debt_array" 
     android:layout_marginRight="10dip" android:layout_marginLeft="50dip" 
     android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:background="@drawable/my_ac_spinner_bg" android:paddingLeft="5dip" 
     android:gravity="center_vertical" android:popupBackground="@drawable/my_ac_round_rect"/> 

Java代碼是這樣的:

Spinner spin = (Spinner) findViewById(R.id.my_ac_debt_card_spinner); 
      final ArrayAdapter<String> a = new SpinnerAdapter(
        getActivity(), 
        android.R.layout.simple_spinner_dropdown_item, 
        debit_array); 
      spin.setAdapter(a); 

但我不能夠設置彈出的對話框的背景。 任何人都可以請幫我解決這個問題。 在此先感謝。

+0

嘿,挖一個很舊的帖子......你能做到嗎? –

回答

-1

嘗試改變

android:popupBackground="@drawable/my_ac_round_rect" to 

android:background="@drawable/my_ac_round_rect" 

而且,這裏是一個很好的博客,我在定製微調發現:http://www.gersic.com/blog.php?id=57

0

嘗試把這個代碼放到你的ListAdapter的微調中getDropDownView:

if (parent != null && parent instanceof ListView) { 
     ((ListView) parent).setBackgroundResource(R.drawable.background); 
    }