标签:
final static int[] COLOR_LIST={Color.WHITE,Color.WHITE,Color.GRAY,Color.YELLOW,Color.RED}; spinner=(Spinner)findViewById(R.id.spinner1); ArrayAdapter ad=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,Constants.CONTENT_TYPE) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { TextView view=(TextView) super.getDropDownView(position, convertView, parent); view.setTextColor(Constants.COLOR_LIST[position]); return view; } }; ad.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(ad);
终于找到一个靠谱的了
TextView view=(TextView) super.getDropDownView(position, convertView, parent);
本来返回的是view
转成textView后就可以当成TextView设置它的颜色了
标签:
原文地址:http://www.cnblogs.com/sweetculiji/p/4185590.html