// try this custom adapter for spinner
class MyCustomAdapter extends ArrayAdapter<String> {
Context context;
ArrayList<String> list;
private int defaultPosition;
public int getDefaultPosition() {
return defaultPosition;
}
public MyCustomAdapter(Context context, ArrayList<String> objects) {
super(context, 0, objects);
this.context = context;
list = objects;
}
public void setDefaultPostion(int position) {
this.defaultPosition = position;
}
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustom(position, convertView, parent);
}
public View getCustom(int position, View convertView, ViewGroup parent) {
View row = LayoutInflater.from(context).inflate(
android.R.layout.simple_spinner_item, parent, false);
TextView label = (TextView) row.findViewById(android.R.id.text1);
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/yourfontsname");
label.setTypeface(tf);
label.setText(list.get(position));
return row;
}
public View getCustomView(int position, View convertView,
ViewGroup parent) {
View row = LayoutInflater.from(context).inflate(
android.R.layout.simple_spinner_item, parent, false);
TextView label = (TextView) row.findViewById(android.R.id.text1);
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/yourfontname");
label.setTypeface(tf);
label.setText(list.get(position));
return row;
}
}