【发布时间】:2014-01-02 12:11:59
【问题描述】:
在我的应用中有一个微调器,微调器的选定项是白色的。
而且我的应用背景也是白色的。所以我看不到微调器上显示的文本(在 0 位置)
如何更改微调器的文本颜色。如果您还告诉我如何更改微调器的边框颜色,我将更加感谢。 Spinner 在白色背景中显示明亮。
我的代码:
CustomAdapter1<String> arrayAdapter1 = new CustomAdapter1<String>(IRCMSActivity.this,
android.R.layout.simple_spinner_item, divisions, 0);
arrayAdapter1.setDropDownViewResource(R.drawable.spinner_button);
spinner.setAdapter(arrayAdapter1);
自定义适配器类:
class CustomAdapter1<T> extends ArrayAdapter<String> {
public CustomAdapter1(Context context, int textViewResourceId,
String[] symboles, int value) {
super(context, textViewResourceId, symboles);
}
public View getView(int position, View convertView, ViewGroup parent,
int value) {
View view = super.getView(position, convertView, parent);
final TextView textView = (TextView) view
.findViewById(android.R.id.text1);
textView.setText(divisions[position]);
return view;
}
}
我可以在模拟器中看到黑色文本(用红色四舍五入),但在平板电脑中,文本变为白色。我不知道它正在发生。无法在选项卡中进行屏幕截图,因此发布了模拟器屏幕截图。 请帮忙。
【问题讨论】:
-
您可以为此使用自定义布局。见stackoverflow.com/questions/20760442/…
-
@MD 尝试获得相同的结果。我不知道为什么。:(
-
发布您的所有代码并快照以便更好地理解
-
发帖请看。