It is possible to use an icon font in Android inside TextViews. It will work on any Android version, and personally, I find it easy and convenient to use.
To achieve this there are only 3 steps needed:
1.- Add the font in the assets/fonts folder.
2.- Set the icon font in the TextView as its Typeface (There are many ways to do it)
Users who want to use this method instead of using Vector Drawables or 3rd party libraries could benefit from having an official "Material Design Icons" strings.xml instead of building it themselves.
It is possible to use an icon font in Android inside TextViews. It will work on any Android version, and personally, I find it easy and convenient to use.
To achieve this there are only 3 steps needed:
1.- Add the font in the
assets/fonts
folder.2.- Set the icon font in the TextView as its Typeface (There are many ways to do it)
3.- Set the code of the icon as the
text
in the TextViewWhat I am suggesting is to have an autogenerated
string.xml
file that would look like something like this.Users who want to use this method instead of using Vector Drawables or 3rd party libraries could benefit from having an official "Material Design Icons"
strings.xml
instead of building it themselves.Thank you in advance.