Android Question Set FontAwesome & Material Icons TypeFace in code

klaus

Expert
Licensed User
Longtime User
What is the best method to set the FontAwesome & Material Icons TypeFaces to a view added in the code?
Currently I added the MaterialIcons.ttf file to the Assets folder and created a new TypeFace:
B4X:
Private MyTypeface as Typeface
MyTypeface = Typeface.LoadFromAssets("B4X_MaterialIcons.ttf")
Label1.Text = Chr(0xE149)
 

DonManfred

Expert
Licensed User
Longtime User
Erels suggested way is to set a label in designer with this fontface. In code you then can get the fontface from the label loaded by the design and put it on other views.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Erel, will there be a more 'direct' method in the future?
Because I am using it in a CustomView class.
Adding it in the Designer no problem.
But I want the user also be able to add in the code.
Therefore I need to add the hidden Label and set the Typeface as a property.
 
Last edited:
Upvote 0
Top