2012-02-15 67 views
7

我想更改默認ActionBar選項卡的高度,但找不到任何有關的信息。是否有一些樣式屬性或方法來設置標籤的高度? 謝謝。ActionBar選項卡高度

+0

參考這篇文章[閱讀此篇] [1] [1]:http://stackoverflow.com/questions/13827762/actionbar-with-navigation-tabs-changes-height-with-screen-方向 – 2013-07-09 08:51:06

回答

7

這是您如何設置選項卡的樣式。雖然,我實際上難以改變的高度。我不確定你可以通過Style設置高度到TabView。您可能必須創建自定義視圖並將其應用於代碼中的選項卡。您需要引用的所有樣式和屬性都在SDK中。查看您正在使用的平臺版本的「值」文件夾。這就是我通常瞭解如何做到這一點的方式。

<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> 
+2

我認爲身高不能受到影響.... 即使我沒有得到解決方案,我試過的東西沒有工作.. 猜測這是默認 – 2012-02-15 03:24:51

+0

此解決方案中的代碼不起作用。 – 2015-07-27 15:15:07

8

您必須更改操作欄的高度才能更改選項卡的高度。

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> 
+1

這工作對我來說... – 2012-10-01 06:47:55

+1

+對我來說也... :) – 2012-11-09 09:49:01

+0

從哪裏是tab_nav和tab_nav_text? – 2013-02-23 14:46:10

0

注意使用

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

代替

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

導致以下問題:如果從[NoActionBar活動]切換到[ ActionBar活動] ActionBar將JUMP