I have a TextView in which the text foe an example is: "Android"
Now, I have to change the text style for first 3 char is "And" and except are in normal format.
I follow this SO link for the solution : Solution link
In which Typeface is using through below format and it is working fine
final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD);
but
I need to access the style / Typeface from Assets folder like: Parisienne-Regular.ttf
How can I pass the Assets file into this StyleSpan programatically ?
Edit 1;
<font size="..." color="..." face="...">
I found from this - link - but when I applied
tnew.setText(Html.fromHtml(" And"+"<font face='Parisienne'>"+ "a"+ "</font>"));
also not working.
Ans:
Typeface font1 = Typeface.createFromAsset(getAssets(), "Parisienne-Regular.ttf");
SS.setSpan (new CustomTypeFaceSpan("", font1), 3, 4,Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tnew.setText(SS);
And this LINK