Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change text size on tabHost

I'm trying to do a tabHost with 2 tabs, its ok, but i want to change text size, I search a lot but I don't find anything without change all layout of tab, i just want change text size, not change background or anything like that, i add my tabs like this:

tabHost.addTab(tabHost.newTabSpec("photos_tab").setIndicator(getString(R.string.userPhotos)).setContent(R.id.tab2));

when I try to put a TextView in setIndicator its work and I can change text size but change everything, click, background and other things.. so I want to change only text size.

any ideas?

ps: I'm not extend TabActivity, so I can't change Theme in AndroidManifest or something like this. (I tried it before: How to change the font size of tabhost in android)

Thanks.

like image 273
kavain Avatar asked Sep 27 '12 14:09

kavain


1 Answers

Yes, You can do that by getting the child at a specified position and getting its textview and setting the textsize of it.

 TextView x = (TextView) tabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title);
    x.setTextSize(25);
like image 93
Hardik4560 Avatar answered Oct 11 '22 15:10

Hardik4560