MaterialShowcaseView icon indicating copy to clipboard operation
MaterialShowcaseView copied to clipboard

Using custom font

Open MahdiFarzami opened this issue 9 years ago • 3 comments

How can i set custom font to MaterialShowcaseView ?

MahdiFarzami avatar Oct 29 '16 20:10 MahdiFarzami

Any Idea??

iman2420 avatar May 30 '17 17:05 iman2420

  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 methodpublic 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"))`

mimre73 avatar Oct 20 '18 05:10 mimre73

or simply, download the library, make a new method in the builder, and set the Typeface to the textViews. ez

AmineMessabhia avatar Nov 11 '18 18:11 AmineMessabhia