In my app I am displaying a spinner that contains different font styles e.g. if the font name is US DNealian than it should get displayed with the same typeface as well. I know how to set typeface of particular view by view.setTypeface(tf) but I am using an array arr_fonts to fill ArrayList and that ArrayList will fill the adapter for spinner. Below is the code snippet I am using.
-> String array for filling ArrayList
private String arr_fonts[] = {"US: D'Nealian", "US: D'Nealian Cursive", "US: Zaner-Bloser", "US: Zaner-Bloser Cursive",
"Aus: NSW/ACT", "Aus: NSW/ACT Cursive", "Aus: Qld Beginners", "Aus: Qld Cursive", "Aus: SA Beginners", "Aus: SA Cursive",
"Aus: Tas Beginners", "Aus: Tas Cursive", "Aus: Vic/NT/WA", "Aus: Vic/NT/WA Cursive", "WA Sassoon", "WA Sassoon Infant",
"NZ Beginners","UK Beginners", "UK Cursive", "Century Gothic (HWT)"};
->Arraylist for filling adapter
ARRLIST_FONTS = new ArrayList<String>(Arrays.asList(arr_fonts));
private void set_font_name_Adapter() {
sp_fonts = (Spinner)findViewById(R.id.spFont);
font_name_Adapter= new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,ARRLIST_FONTS)
{
public View getView(int position, View convertView,ViewGroup parent) {
View v = super.getView(position, convertView, parent);
((TextView) v).setTextSize(12);
((TextView) v).setTextColor(Color.WHITE);
return v;
}
};
font_name_Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_fonts.setAdapter(font_name_Adapter);
sp_fonts.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
font = ARRLIST_FONTS.get(arg2);
}
System.out.println("Selected item is ................."+font);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
}
I have .ttf for all the font names. But I dont know how to change typeface of each item in spinner individually.
Can anyone suggest any thing or any link or good tutorial for the same.
Thanks.

try as to set custom Typeface for all TextView’s in spinner :