2014-09-21 92 views
0
View view = inflater1.inflate(R.layout.main, null); 
ArrayAdapter<String> adap = new ArrayAdapter<String>(getActivity(), R.layout.spin_text), (String[]) getResources().getStringArray(R.array.itemlist)); 
Spinner spin = (Spinner)view.findViewById(R.id.spin); 
spin.setAdapter(adap); 

我使用像上面那樣的微調。 現在,我想改變Java代碼微調的項目顏色,我想這就像:如何更改微調器的項目文字顏色?

View view_text = inflater2.inflate(R.layout.spin_text, null); 
TextView spin_text = (TextView)view_text.findViewById(R.id.spin_text); 

<!-- spin_text.xml --> 
<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/spin_text" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textSize="15sp" 
    android:textColor="#000000" 
    android:padding="4dp" > 
</TextView> 

當我點擊一個按鈕,此代碼的工作:

spin_text.setTextColor(colorCode); 

,但並沒有改變什麼.. 我做錯了什麼?

回答

0

你試過嗎?

spinner.setBackgroundResource(R.drawable.spinner_background); 

我不能評論(信譽< 50);

相關問題