spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View v,
int arg2, long arg3) {
// TODO Auto-generated method stub
TextView tv = (TextView)v;
tv.setTextColor(getResources().getColor(R.color.black));
tv.setGravity(Gravity.CENTER);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
@Override
public void onItemSelected(AdapterView<?> arg0, View v,
int arg2, long arg3) {
// TODO Auto-generated method stub
TextView tv = (TextView)v;
tv.setTextColor(getResources().getColor(R.color.black));
tv.setGravity(Gravity.CENTER);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
我们只能给spinner添加一个选择的监听来实现字体颜色的改变。