July 17, 2010

[SOLVED]How customize/extend/ Spinner

You will need to take control over what goes into the ListView and
Spinner. I have not experimented with these techniques on Spinner, but
on ListView, you will need to override getView() (on ArrayAdapter) or
newView() and bindView() (on CursorAdapter).
Here is a free excerpt from one of my books that demonstrates the technique:

http://commonsware.com/Android/excerpt.pdf

In your case, you would use your Typeface object to update the font used
by the TextView widgets in your rows.

In principle, you could do this via a wrapping adapter -- this would be
more reusable but a bit slower. I have an AdapterWrapper base class here:

http://github.com/commonsguy/cwac-adapter

and some projects that use it here:

http://github.com/commonsguy/cwac-endless
http://github.com/commonsguy/cwac-thumbnail


You also need to override getDropDownView().

Source: How to change the Typeface of ListView and Spinner - Android Beginners Google Groups.

No comments:

Post a Comment