views:

23

answers:

1

I'm creating a spinner in my layout xml files and setting an string array to this spinner. If I change the textstyle of the spinner the text is not affected by the changes.

I read in the googlegroups that a spinner has no text and therefore the textstyle can not be changed and I have to change the style of the textview that is shown in the spinner. But how can I do that. Preferably in my xml file.

+1  A: 

When you create the Adapter that backs the Spinner you can set a layout for the spinner item.

spinner.setAdapter(new ArrayAdapter(this, R.id.some_text_view));

You can style some_text_view the way you want.

<TextView android:id="@+id/some_text_view" android:textStyle="bold" />
BrennaSoft
and there is no possibility to do this within the xml file? If I set the items in the xml I do not need to set an ArrayAdapter myself...
Janusz
If you use android:entries then internally it creates an ArrayAdapter with android.R.layout.simple_spinner_item as the layout and no you can't change that layout since it is an internal to android.
BrennaSoft