2012-04-23 105 views
3

所以我試圖使用ActionBarSherlock庫實現我的Actionbar的選項卡。這是我的代碼:設計Actionbarsherlock選項卡

<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow"> 
       <item name="actionBarTabStyle">@style/CustomActionBarStyle</item> 
       <item name="android:actionBarTabStyle">@style/CustomActionBarStyle</item> 

      <style name="CustomActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar"> 
       <item name="android:background">@drawable/actionbar_tab_bg</item> 
      </style> 

在二,三線,如果我改變actionBarTabStyle到actionBarStyle,我的動作條本身改變我想要的風格(不是很順利着,當然),這樣的連接做的工作。但是,嘗試更改操作欄選項卡(位於其下方)仍然沒有成功。

我希望有人能幫助我。

與問候,

+0

您是否檢查過「style」的開始和結束標記? – 2012-04-24 21:20:05

回答

13

下面應該工作

<style name="Theme.app" parent="@style/Theme.Sherlock.Light"> 
     <item name="android:actionBarTabBarStyle">@style/Theme.app.tabbar.style</item> 
     <item name="actionBarTabBarStyle">@style/Widget.app.ActionBar.TabBar</item> 
</style> 

<style name="Theme.app.tabbar.style" parent="@style/Theme.Sherlock.Light"> 
    <item name="android:background">#FF0000</item> 
    <item name="background">#FF0000</item> 
</style> 

<style name="Widget.app.ActionBar.TabBar" parent="Widget.Sherlock.ActionBar.TabBar"> 
    <item name="android:background">#FF0000</item> 
    <item name="background">#FF0000</item> 
</style> 

這使得使用TabBar紅。

您需要設置兩次actionBarTabBarStyle。這是因爲Android的> 3.0和Android <的3.0

+0

我在做類似的事情! http://stackoverflow.com/questions/19623805/actionbarsherlock-stacked-action-bar-styling-issue – toobsco42 2013-10-27 21:33:36

+0

這確實有效。 TY! – 2014-07-01 19:21:38

5

在你CustomActionBarStyle你需要有

<item name="android:background">@drawable/actionbar_tab_bg</item> 
<item name="background">@drawable/actionbar_tab_bg</item> 

希望這有助於:)

+0

感謝您的回覆。但是,它仍然不符合你的建議。我真的不知道問題在這裏。 – Hidde 2012-04-24 13:40:38

+0

您是否嘗試過使用父'Widget.Sherlock.Light.ActionBar.TabView'? – chuckliddell0 2012-04-24 14:27:26

+0

@ chuckliddell0不適用於我 – noloman 2012-06-22 09:06:52

0

因此,我不得不因爲某種方式與造型一些困難,我發現通過代碼首先添加的標籤。謝謝你的迴應,他們都工作。

相關問題