views:

58

answers:

2

Hi,

I have a spinner with items, populated via ArrayAdapter. I want to change font style for some (not for all) of spinner items, both for spinner's combobox and listbox. I guess that I need to subclass something, but I don't understand what. How can I do that?

Thanks!

+1  A: 

You need to apply fonts (typeface) to the TextViews of the layouts. Extract them through R.id.* or by supplying your own custom layout

Sameer Segal
You mean I have to create my own layout instead of using simple_spinner_item and simple_spinner_dropdown_item? But how can I do that for specific spinner items? E. g. I am doing _adTo.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); so if I will change it to my_italic_layout, every item will be italic.
Stipa
+1  A: 

Ok I got it.

  1. Subclass ArrayAdapter and override getView and getDropDownView.
  2. In those methods, call super.getView or super.getDropDownView and save returned value.
  3. Set Typeface for view returned at (2) (thx Sameer Segal).
Stipa