2016-04-28 111 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以创建项目。

相关问题