Custom font in preference-v7
Closed this issue · 6 comments
Hi, how to add custom font?
You can override the styles to include your own font family but it is pretty cumbersome and there's no other way around it.
Override the styles is hard-coded form, If the font allows custom settings, how do?
There's no other way because the default Preference
class does not provide this option and the TextView
s (among other View
items) are inaccessible. The only way would be to override the Preference
class and use custom methods for setting the font family but this would also require all of the other Preference
dependent classes to be overridden which is just too much work for too little gain. Also, you'd face more problems as you go deeper because you cannot change the font of the AlertDialog
used by e.g. the ListPreference
. This is the same argument again as with the programmatically changeable colors.
- Use "Spannable" to set the font
- Use Reflection to get "TextView"
You can do the first without requiring any extra methods in this lib.
The second one still requires overriding all of the Preference
children.
OK, I will try.