2014-08-28 114 views
0

的大小我嘗試通過風格的資源來改變文字的顏色和我的動作條的大小:更改文本顏色和動作條

<?xml version="1.0" encoding="utf-8"?> 
<resources xmlns:android="http://schemas.android.com/apk/res/android"> 

    <style name="Theme.Example3" parent="@android:style/Theme.Holo.Light"> 
     <item name="android:actionBarItemBackground">@drawable/selectable_background_example3</item> 
     <item name="android:popupMenuStyle">@style/PopupMenu.Example3</item> 
     <item name="android:dropDownListViewStyle">@style/DropDownListView.Example3</item> 
     <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Example3</item> 
     <item name="android:actionDropDownStyle">@style/DropDownNav.Example3</item> 
     <item name="android:actionBarStyle">@style/ActionBar.Solid.Example3</item> 
     <item name="android:actionModeBackground">@drawable/cab_background_top_example3</item> 
     <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_example3</item> 
     <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example3</item> 
    </style> 

    <style name="ActionBar.Solid.Example3" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> 
     <item name="android:background">@drawable/ab_solid_example3</item> 
     <item name="android:backgroundStacked">@drawable/ab_stacked_solid_example3</item> 
     <item name="android:backgroundSplit">@drawable/ab_bottom_solid_example3</item> 
     <item name="android:progressBarStyle">@style/ProgressBar.Example3</item> 
    </style> 

    <style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="@android:style/TextAppearance.Medium"> 
     <item name="android:textSize">20sp</item> 
     <item name="android:textColor">@color/white</item> 
    </style> 

    <style name="ActionBar.Transparent.Example3" parent="@android:style/Widget.Holo.Light.ActionBar"> 
     <item name="android:background">@drawable/ab_transparent_example3</item> 
     <item name="android:progressBarStyle">@style/ProgressBar.Example3</item> 
    </style> 

    <style name="PopupMenu.Example3" parent="@android:style/Widget.Holo.Light.ListPopupWindow"> 
     <item name="android:popupBackground">@drawable/menu_dropdown_panel_example3</item> 
    </style> 

    <style name="DropDownListView.Example3" parent="@android:style/Widget.Holo.Light.ListView.DropDown"> 
     <item name="android:listSelector">@drawable/selectable_background_example3</item> 
    </style> 

    <style name="ActionBarTabStyle.Example3" parent="@android:style/Widget.Holo.Light.ActionBar.TabView"> 
     <item name="android:background">@drawable/tab_indicator_ab_example3</item> 
    </style> 

    <style name="DropDownNav.Example3" parent="@android:style/Widget.Holo.Light.Spinner"> 
     <item name="android:background">@drawable/spinner_background_ab_example3</item> 
     <item name="android:popupBackground">@drawable/menu_dropdown_panel_example3</item> 
     <item name="android:dropDownSelector">@drawable/selectable_background_example3</item> 
    </style> 

    <style name="ProgressBar.Example3" parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"> 
     <item name="android:progressDrawable">@drawable/progress_horizontal_example3</item> 
    </style> 

    <style name="ActionButton.CloseMode.Example3" parent="@android:style/Widget.Holo.Light.ActionButton.CloseMode"> 
     <item name="android:background">@drawable/btn_cab_done_example3</item> 
    </style> 

    <!-- this style is only referenced in a Light.DarkActionBar based theme --> 
    <style name="Theme.Example3.Widget" parent="@android:style/Theme.Holo"> 
     <item name="android:popupMenuStyle">@style/PopupMenu.Example3</item> 
     <item name="android:dropDownListViewStyle">@style/DropDownListView.Example3</item> 
    </style> 

</resources> 

以上style.xml包含下面的代碼的一部分,它應該改變文字顏色和大小,但它在我的操作欄上沒有發生任何事情:

<style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="@android:style/TextAppearance.Medium"> 
     <item name="android:textSize">20sp</item> 
     <item name="android:textColor">@color/white</item> 
    </style> 

什麼是錯?

謝謝!

+0

我沒有看到這樣的事情: ' @ style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle' – MartinCR 2014-08-28 15:17:15

+0

實際上它在那裏:-)。第三塊風格 – 2014-08-28 15:22:31

+0

如果你沒有指定你的活動來使用你的清單中的樣式,什麼都不會發生('andorid:style =「@ style/someTheme」') – Gumbo 2014-08-28 15:26:13

回答

0
<item name="android:titleTextStyle">@style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item> 

<style name="ActionBar.Solid.Example3">

0

問題缺少的是你需要的風格第三塊從款式的第二塊內鏈接:

<style name="ActionBar.Solid.Example3" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> 
    <item name="android:background">@drawable/ab_solid_example3</item> 
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_example3</item> 
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_example3</item> 
    <item name="android:progressBarStyle">@style/ProgressBar.Example3</item> 

    <item name="android:titleTextStyle">@style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item> 

</style> 
+0

謝謝,也正確 – 2014-08-28 15:26:35