There's no TextView for me to setType in the Activity and setting it through a custom class and XML is a real memory drag so is there another way?
Asked
Active
Viewed 1,898 times
2 Answers
1
How do you change the font of the list on a navigation drawer?
The same way you "change the font" of any ListView
: by customizing your rows from your ListAdapter
. For example, for an ArrayAdapter
, you create a subclass, override getView()
, and apply your setTypeface()
call there.
setting it through a custom class and XML is a real memory drag
And your proof of this is... what, exactly?

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
No proof, just this thread ( http://stackoverflow.com/questions/2376250/custom-fonts-and-xml-layouts-android/7197867?noredirect=1#comment-11263047 )but if you say it doesn't I believe you. getView returns CreateViewFromResource and that's the method where the logic really happens, so should I override that too? – Thiago Aug 06 '13 at 03:34
0
There's no TextView for me to setType in the Activity and setting it through a custom class and XML is a real memory drag so is there another way?
No it's absolutely fine to define custom TextViews
, since the TextView
has to set a Typeface either way.

Ahmad
- 69,608
- 17
- 111
- 137
-
I really dont know much of the internals of Android to havean opinion about it. I was just following this comment"One thing to note is that it will generate dozens and dozens of TypeFace objects and eat up memory. There is a bug in pre4.0 Android that doesnt free up TypeFaces properly. The easiest thing to do is create a TypeFace cache with a HashMap. This brought memory usage in my app down from 120+ mb to 18mb. code.google.com/p/android/issues/detail?id=9904 " made on thread http://stackoverflow.com/questions/2376250/custom-fonts-and-xml-layouts-android/7197867?noredirect=1#comment-11263047 – Thiago Aug 05 '13 at 22:53