2016-04-28 8 views
0

タイトルの背景が変わるようにダイアログのテーマを変更しました。スピナーの背景も黒に変わり、アイテムのテキストの色も黒で、問題が発生しました。ここスピナーのテキストの色を変更するには?

は私style.xmlコードです:

<style name="question_dialog" parent="@android:style/Theme.Holo.Dialog"> 
    <item  
name="android:windowTitleStyle">@style/question_dialog_title</item> 
</style> 

<style name="question_dialog_title" parent="android:Widget.TextView"> 
    <item name="android:background">#161616</item> 
    <item name="android:textSize">21sp</item> 
    <item name="android:textColor">#e1e1e1</item> 
</style> 

、ここでは、ダイアログの写真です: http://s32.postimg.org/ixt6rm02d/13128639_1306213616061269_1278459383_o.jpg

私を助けてください:))

答えて

1

用のカスタムXMLファイルを作成しますあなたのスピナーアイテム。

spinner_item.xml:

は、このファイル内のテキストにカスタマイズした色とサイズを与えます。

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:textSize="20sp" 
android:gravity="left" 
android:textColor="#FF0000"   
android:padding="5dip" 
/> 

は今、アダプタにこのXMLを渡す:

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list); 

あなたは、リソースのドロップダウンを設定する必要はありません。あなたのアイテムをスピナーに表示するためだけにspinner_item.xmlが必要になります。

0

クリート項目XMLのように続いて <?xml version="1.0" encoding="utf-8"?>

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:textSize="20sp" 
android:gravity="left" 
android:textColor="#FF0000" 
android:padding="5dip"/> 

、作成された項目にADAPするアダプタを使用します。

関連する問題