How set Spannable object font with custom font

This is a late answer but will help others to solve the issue. Use the following code:(I’m using Bangla and Tamil font) TextView txt = (TextView) findViewById(R.id.custom_fonts); txt.setTextSize(30); Typeface font = Typeface.createFromAsset(getAssets(), “Akshar.ttf”); Typeface font2 = Typeface.createFromAsset(getAssets(), “bangla.ttf”); SpannableStringBuilder SS = new SpannableStringBuilder(“আমারநல்வரவு”); SS.setSpan (new CustomTypefaceSpan(“”, font2), 0, 4,Spanned.SPAN_EXCLUSIVE_INCLUSIVE); SS.setSpan (new CustomTypefaceSpan(“”, font), 4, 11,Spanned.SPAN_EXCLUSIVE_INCLUSIVE); … Read more

How to set default font family for entire Android app

The answer is yes. Global Roboto light for TextView and Button classes: <style name=”AppTheme” parent=”AppBaseTheme”> <item name=”android:textViewStyle”>@style/RobotoTextViewStyle</item> <item name=”android:buttonStyle”>@style/RobotoButtonStyle</item> </style> <style name=”RobotoTextViewStyle” parent=”android:Widget.TextView”> <item name=”android:fontFamily”>sans-serif-light</item> </style> <style name=”RobotoButtonStyle” parent=”android:Widget.Holo.Button”> <item name=”android:fontFamily”>sans-serif-light</item> </style> Just select the style you want from list themes.xml, then create your custom style based on the original one. At the end, apply … Read more