How to change the text size and padding tabs in tabHost?

Asked

Viewed 240 times

0

I have a tabHost and I needed to change the padding and the size of the texts in the tabs. Does anyone know how to do this? via code or via xml? Thanks in advance.

1 answer

3


Fala Daniel,

You need to create a theme for your Activity that has tabHost la on Androidmanifest.xml, example:

<activity 
     android:name="MyTabActivity" 
     android:theme="@style/CustomTheme">

Done this, you need to add this theme there in your style.xml (res/values/Styles.xml), example:

<style name="CustomTheme" parent="@android:style/Theme">
    <item name="android:tabWidgetStyle">@style/CustomTabWidget</item>
</style>
<style name="CustomTabWidget" parent="@android:style/Widget.TabWidget">
    <item name="android:textAppearance">@style/CustomTabWidgetText</item>
</style>
<style name="CustomTabWidgetText" 
    parent="@android:style/TextAppearance.Widget.TabWidget">
    <item name="android:textSize">20sp</item>
    <item name="android:textStyle">bold</item>
</style>

Now you can change, text color, size, style and etc...etc...etc etc...

Any doubt in the implementation put there that I help you.

Hugs.

  • Thank you, it worked perfectly! Hugs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.