2011-12-31 70 views
0

在我styles.xml文件我有一個風格刪除標題欄和其他樣式改變我tabwidget的字體大小:主題相互重疊?

<?xml version="1.0" encoding="utf-8"?> 

<style name="RemoveTitleBar" parent="android:Theme"> 
    <item name="android:style/Theme.Black.NoTitleBar.Fullscreen">true</item> 
<item name="android:windowNoTitle">true</item> 

</style> 

<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">12sp</item> 
    <item name="android:textStyle">bold</item> 
</style> 

在我的AndroidManifest.xml文件我將RemoveTitleBar樣式設置爲可以正常工作的應用程序:

<application 
    android:icon="@drawable/ic_launcher_test_icon" 
    android:label="@string/app_name" 
    android:theme="@style/RemoveTitleBar" 
.... 

但是,當我將CustomTheme樣式應用於帶有製表符的活動時,我會返回標題欄。但是,如果我刪除線,它工作正常。

<activity android:name=".TabActivity" 
       android:label="@string/app_name" 
       android:screenOrientation="portrait" 
       android:theme="@style/CustomTheme"> </activity> 

我該怎麼做,或者我必須改變我的styles.xml文件中的東西?謝謝你的時間。

回答

0

你是在擴展CustomTheme"android:style/Theme"

<style name="CustomTheme" parent="android:style/Theme"> 
    <item name="android:tabWidgetStyle">@style/CustomTabWidget</item> 
</style> 

titleBar是在這個你不刪除titleBar可用,你將再次需要刪除titleBar這樣的:

<style name="CustomTheme" parent="android:style/Theme"> 
    <item name="android:tabWidgetStyle">@style/CustomTabWidget</item> 
    <item name="android:style/Theme.Black.NoTitleBar.Fullscreen">true</item> 
</style> 
+0

非常感謝。我實際上改變了父母的兩個樣式爲parent =「android:style/Theme.NoTitleBar」,所以我不需要將它放在每個項目下。非常感謝! :O) – joelreeves 2012-01-01 16:30:34