I’m using a custom font throughout my application (which, incidentally, I’ve frustratingly found out that you have to apply programmatically by hand to EVERY control!), and I need to apply it to a listview. The problem is that I can’t see where I’d set the textview used in the list’s font to my custom font (as I never instantiate it – that’s all taken care of by the adapter).
What I’d ideally like is to be able to use an adapter like this:
new ArrayAdapter(Context context, TextView textView, List<T> objects)
That way I could do: textView.setTypeface before populating my list. Does anyone know if there’s a way to do something along these lines?
You can’t do it that way because the text view resource you pass to the ArrayAdapter is inflated each time it is used.
You need to create your own adapter and provide your own view.
An example for your adapter could be
}
And then you could set that as such
Hopefully that should get you going.