I have a question regarding adding multiple custom fonts to textview. I have basically added the fonts in fonts folder and have created a java class for fonttextview based on the solutions i found online. However I see they have added only one font and I want to add multiple fonts like roboto-regular,roboto-bold,cabin-bold etc. Here's the code I have so far:
public class FontTextView extends TextView {
public FontTextView(Context context) {
super(context);
Typeface face=Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Bold.ttf");
this.setTypeface(face);
}
public FontTextView(Context context, AttributeSet attrs) {
super(context, attrs);
Typeface face=Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Bold.ttf");
this.setTypeface(face);
}
public FontTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
Typeface face=Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Bold.ttf");
this.setTypeface(face);
}
How do I go about it creating multiple fonts? Also, I tried the styleable etc, but it shows error as it doesnt support styleable class, can anyone add another font to this existing code and walk me through the retrieval process?
Thanks! Justin