MaterialTabHost icon indicating copy to clipboard operation
MaterialTabHost copied to clipboard

I want to change the font of text on MaterialTabhost ?

Open cop0077 opened this issue 8 years ago • 2 comments

I tried varies methods of changing the font. Like trying to get textview (its private-- cant access).

How do i set different fonts for different tabs ? Please help .

here is my question http://stackoverflow.com/questions/35988592/how-to-change-font-of-text-in-materialtabhost-in-android

cop0077 avatar Mar 14 '16 13:03 cop0077

I found solution for this.

Typeface fntRoboRegular = Typeface.createFromAsset(getAssets(), "Roboto-Regular.ttf");
        for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
            TextView tv = (TextView) tabHost.getTabWidget().getChildAt(i);
            if (i == 0)
                tv.setTextColor(ContextCompat.getColor(context, R.color.clrBlue));
            else
                tv.setTextColor(ContextCompat.getColor(context, R.color.clrLiteBlue));
            tv.setTextSize(10);
            tv.setTypeface(fntRoboRegular);
        }

veersamrat avatar Jan 06 '17 09:01 veersamrat

we can use above code

rajlee5129 avatar Jan 09 '17 01:01 rajlee5129