Open MahdiFarzami opened 7 years ago
Any Idea??
1) create class typeface span `public class TypefaceSpan extends MetricAffectingSpan {
private final Typeface typeface;
public TypefaceSpan(Typeface typeface) { this.typeface = typeface; }
@Override public void updateDrawState(TextPaint tp) { tp.setTypeface(typeface); tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); }
@Override public void updateMeasureState(TextPaint p) { p.setTypeface(typeface); p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); }
} 2)create a method
public static SpannableString typeface(Typeface typeface, CharSequence string) {
SpannableString s = new SpannableString(string);
s.setSpan(new TypefaceSpan(typeface), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return s;
} 3)then
.setContentText(typeface("your typeface","your contentText"))`
or simply, download the library, make a new method in the builder, and set the Typeface to the textViews. ez
How can i set custom font to MaterialShowcaseView ?