7

I want to change default ActionBar tab's height, but can't find any info about. Is there some style attribute or method to set height of tabs? Thanks.

deviant
  • 3,539
  • 4
  • 32
  • 47
  • Refer this post [Read this post][1] [1]: http://stackoverflow.com/questions/13827762/actionbar-with-navigation-tabs-changes-height-with-screen-orientation – Manav Singhal Jul 09 '13 at 08:51

3 Answers3

8

You have to change the height of the actionbar in order to change the height of the tabs.

theme.xml

<style name="YourTheme" parent="@android:style/Theme.Holo">
    <item name="android:actionBarTabStyle">@style/tab_nav</item>
    <item name="android:actionBarTabTextStyle">@style/tab_nav_text</item>
    <item name="android:actionBarSize">80dp</item>
    ..
</style>
Felix
  • 1,097
  • 1
  • 10
  • 16
  • From where is the tab_nav and tab_nav_text ? – Vince V. Feb 23 '13 at 14:46
  • That are styles which you'll have to define on your own :) So, just placeholder. – Felix Mar 25 '13 at 08:05
  • 1
    It works but then it also changes the height of the title bar, so it looks kind'a weird. – htafoya Aug 23 '13 at 20:46
  • Yes ! .... If the actionbar is splitted .... titlebar,tab,splittedbar all height change ... so this is not a feasible solution,... According to question .... only the height of tabs must be changed ... But Good to know this option – Devrath Apr 23 '14 at 19:17
  • This just changes the height of the `actionBar`, and pushes the tabs up/down, but they stay the same height – Noam Nelke Jul 27 '15 at 15:17
7

This is how you style the tabs. Although, I was having trouble actually getting the height to change. I'm not sure you can set a height via a Style to the TabView. You may have to create custom View and apply that to your tabs in your code. All the styles and attributes you need to reference are in the SDK. Look in the Values folder of the platform version you're working with. That's how I typically find out how to do this.

<style name="Widget.Holo.Tab" parent="@android:style/Widget.Holo.Light.ActionBar.TabView">
    <item name="android:height">#dp</item>
</style>

<style name="Your.Theme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarTabStyle">@style/Widget.Holo.Tab</item>
</style>
adneal
  • 30,484
  • 10
  • 122
  • 151
  • 2
    i think height cant be affected .... even i did not get the solution and the things i tried did not work.. guess thats default – Its not blank Feb 15 '12 at 03:24
0

Be Aware that using

android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"

instead of

android:theme="@android:style/Theme.Holo.Light.NoActionBar"

leads to the following problem: if you switch from [NoActionBar Activity] to [ActionBar Activity] ActionBar will JUMP

StepanM
  • 4,222
  • 1
  • 21
  • 25