我有一个自定义的带有图像和文本视图的微调器布局,但我注意到,根据制造商的皮肤,你看不到文本,因为颜色。白在白,黑在黑。
我还注意到,我的其他非自定义微调工具都没有做到这一点,而且似乎是自动更改的,所以我的问题是,我如何才能更改文本的颜色,使其可以阅读?
这是一个非自定义微调器
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>发布于 2011-12-30 02:09:48
使用当前主题的默认文本颜色(存储在资源ID android.R.attr.textColorPrimary中):
<TextView android:id="@+id/icon_txt"
android:textColor="?android:attr/textColorPrimary"
... />发布于 2014-11-12 15:28:02
我认为改变你的主题会改变列表视图的外观。
我在这一点上也遇到了麻烦,但我所做的是,我创建了一个新的android应用程序项目,并选择了空白活动(代替空活动),它起作用了(我知道这不是一个好的解决方案,但它解决了我的问题)
https://stackoverflow.com/questions/8671413
复制相似问题