2013-10-15 26 views
0

我正在嘗試使用xml來設置我的標籤。我遵循本指南:https://developer.android.com/training/basics/actionbar/styling.htmlAndroid:爲多個版本設計標籤欄

我的應用程序跨版本2.3.3到4.3。我提出了我的代碼,但老實說我沒有,因爲我不知道從哪裏開始。該教程似乎並不適合我。我所要做的就是更改標籤的背景顏色和文字顏色。 Eclipse生成的結構在文件夾valuesvalues-v11values-v14中具有styles.xml文件。這是我的基礎styles.xml。老實說,我不確定哪些標籤會出現在哪些文件中。

更新

我已經導入了v4和v7支持庫。另外,現在我的styles.xml看起來像這樣

<resources xmlns:android="http://schemas.android.com/apk/res/android"> 

<!-- 
    Base application theme, dependent on API level. This theme is replaced 
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 
--> 
<style name="TCMBaseTheme" parent="@style/Theme.AppCompat.Light"> 
    <!-- 
     Theme customizations available in newer API levels can go in 
     res/values-vXX/styles.xml, while customizations related to 
     backward-compatibility can go here. 
    --> 
</style> 

<!-- Application theme. --> 
<style name="TCMTheme" parent="TCMBaseTheme"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
    <item name="actionBarTabStyle">@style/TCMActionBarTabs</item> 
</style> 

<!-- ActionBar tabs styles --> 
<style name="TCMActionBarTabs" 
     parent="@style/Widget.AppCompat.ActionBar.TabView"> 
    <item name="android:background">@color/tcmblue</item> 
    <!-- tab indicator --> 


    <!-- Support library compatibility --> 
    <item name="background">@color/tcmblue</item> 
</style> 

</resources> 

我設置TCMBaseTheme作爲我在我的表現主題。現在沒有錯誤,但是當我運行應用程序時,沒有改變tabbar顏色。

回答

0

我想你錯過:

<item name="android:actionBarTabStyle">@style/TCMActionBarTabs</item> 

在TCMTheme style

+0

哎呀,沒有看OP的發佈日期的日期... – SlumpA