How to customise the TextView inside a Spinner?

Posted by Janusz on Stack Overflow See other posts from Stack Overflow or by Janusz
Published on 2010-04-26T15:57:25Z Indexed on 2010/04/26 16:13 UTC
Read the original article Hit count: 249

Filed under:
|
|

I have a Spinner with an ArrayAdapter that feeds Values into it.

The Problem is that the text is to long for the view and the result is a very very ugly spinner. As can be seen in the screenshot:

alt text

I tried to pass the Id of my own TextView into the Adapter but everytime the spinner should be shown I get an Exception that the Id I supplied is not valid:

04-26 17:38:39.695: ERROR/AndroidRuntime(4276): android.content.res.Resources$NotFoundException: Resource ID #0x7f09003a type #0x12 is not valid

Where do I have to define the TextView? In a separate xml file? With a surrounding viewgroup?

It would help me a lot if I could see an example of the adapter initialization and the textview definition?

© Stack Overflow or respective owner

Related posts about android

Related posts about layout