Android 如何以编程方式更改微调器的textColor
我正在使用以下代码设置微调器:Android 如何以编程方式更改微调器的textColor,android,spinner,Android,Spinner,我正在使用以下代码设置微调器: ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.country_code_spinner_item, countrySpinnerOptions){ public View getView(int position, View convertView, ViewGroup paren
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.country_code_spinner_item,
countrySpinnerOptions){
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
((TextView) v).setTextColor(Color.parseColor("#808080"));
return v;
}
};
ArrayAdapter=新的ArrayAdapter(此,
R.layout.country\u代码\u微调器\u项目,
CountrySpinner(可选){
公共视图getView(int位置、视图转换视图、视图组父视图){
视图v=super.getView(位置、转换视图、父级);
(文本视图)v.setTextColor(Color.parseColor(#808080”);
返回v;
}
};
这会将文本的默认颜色指定为“#8080”
现在我也为这个微调器实现了setOnTouchListener方法。我想要的是,虽然最初微调器的彩色文本是8080。但在触摸微调器并从列表中选择新文本之后。颜色现在永久变为黑色
我如何实现这一点
谢谢请添加onTouchListener,您也应该参考这些问题