2011-12-29 127 views
0

我有一个图像和文本视图的自定义微调器布局,但我注意到,取决于制造商的皮肤,你不能看到文本,因为颜色ie。白色白色,黑色黑色。基于背景颜色更改微调器文本颜色

我也注意到,我的其他非自定义旋转器都没有这样做,似乎自动改变,所以我的问题是我如何获得文本颜色改变,以便它可以被读取?

这是一个非定制微调

ArrayAdapter<CharSequence> cAdapter; 
    cAdapter = ArrayAdapter.createFromResource(this, R.array.colors,android.R.layout.simple_spinner_item); 
    int cSpinnerDD = android.R.layout.simple_spinner_dropdown_item; 
    cAdapter.setDropDownViewResource(cSpinnerDD); 
    color.setAdapter(cAdapter); 

定制微调我只是重写视图把图像与文字

这里是它

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal"> 
<ImageView android:id="@+id/icon" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 
<TextView android:id="@+id/icon_txt" 
    android:paddingLeft="25dp" 
    android:textSize="18sp" 
    android:layout_marginTop="5dp" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 
</LinearLayout> 

回答

0

布局使用当前主题的默认文本颜色(存储在资源ID android.R.attr.textColorPrimary中):

<TextView android:id="@+id/icon_txt" 
    android:textColor="?android:attr/textColorPrimary" 
    ... /> 
0

我认为改变你的主题改变了列表视图的外观。

我在这一点上也被卡住了,但是我做的是我做了一个新的android应用程序项目,并选择了空白活动(代替空活动),它工作(我知道这不是一个好的解决方案,但它解决了我的问题问题)

+0

这不是一个答案 – tyczj 2014-11-12 14:30:13