Reputation: 237
I followed the answer from here: StackOverflow: How to change the font size of tabhost in android
It does work, but I lose the Holo theme, and get an old default theme instead. So I tried the following:
<resources>
<style name="AppBaseTheme" parent="android:Theme.Holo.NoActionBar.Fullscreen">
<!-- API 14 theme customizations can go here. -->
<item name="android:tabWidgetStyle">@style/CustomHoloTabWidget</item>
</style>
<style name="CustomHoloTabWidget" parent="@android:style/Widget.TabWidget">
<!-- Custom item for text appearance -->
<item name="android:textAppearance">@style/CustomTabWidgetText</item>
<!-- End -->
<item name="android:tabStripLeft">@null</item>
<item name="android:tabStripRight">@null</item>
<item name="android:tabStripEnabled">false</item>
<item name="android:divider">?android:attr/dividerVertical</item>
<item name="android:showDividers">middle</item>
<item name="android:dividerPadding">8dip</item>
<item name="android:measureWithLargestChild">true</item>
<!-- Following line results in ERROR -->
<item name="android:tabLayout">@android:layout/tab_indicator_holo</item>
<!-- End -->
</style>
<!-- Custom text appearance item definition -->
<style name="CustomTabWidgetText" parent="@android:style/TextAppearance.Widget.TabWidget">
<item name="android:textSize">36sp</item>
<item name="android:textStyle">bold</item>
</style>
<!-- End -->
Essentially what I have done is edit the original definition of Widget.Holo.Tabwidget available here@line:1801 to include a custom definition for textAppearance.
I get the following error:
error: Error: No resource found that matches the given name: attr 'android:tabLayout'.
I just want to change the font size of the tab titles while retaining the Holo theme.
Upvotes: 1
Views: 7378
Reputation: 1271
Try this once
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
TextView tv = (TextView) tabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
tv.setTextSize(23);
}
Upvotes: 15