How to style the menu items on an Android action bar

前端 未结 8 1428
孤城傲影
孤城傲影 2020-11-28 04:55

There\'s been many questions on styling on action bars, but the ones I\'ve found either are relating to styling the tabs, or have answers that don\'t work for me.

Th

相关标签:
8条回答
  • 2020-11-28 05:33

    I know its an old post, but just in case anyone is looking here. I added this to my style.xml and it worked for me.

    <!-- This is the main theme parent -->
    <style name="MyTabStyle">
        <item name="android:actionBarTabTextStyle">@style/MyTabTextStyle</item>
    </style>
    
    <style name="MyTabTextStyle" parent="@android:style/Widget.ActionBar.TabText">
        <item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/pressed_skylogtheme</item>
    </style>
    
    0 讨论(0)
  • 2020-11-28 05:43

    Chris answer is working for me...

    My values-v11/styles.xml file:

    <resources>
    <style name="LightThemeSelector" parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBar</item>
        <item name="android:editTextBackground">@drawable/edit_text_holo_light</item>
        <item name="android:actionMenuTextAppearance">@style/MyActionBar.MenuTextStyle</item>
    </style>
    
    <!--sets the point size to the menu item(s) in the upper right of action bar-->
    <style name="MyActionBar.MenuTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textSize">25sp</item>
    </style>
    
    <!-- sets the background of the actionbar to a PNG file in my drawable folder. 
    displayOptions unset allow me to NOT SHOW the application icon and application name in the upper left of the action bar-->
    <style name="ActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@drawable/actionbar_background</item>
        <item name="android:displayOptions"></item>
    </style>
    
    <style name="inputfield" parent="android:Theme.Holo.Light">
        <item name="android:textColor">@color/red2</item>
    </style>  
    </resources>
    
    0 讨论(0)
提交回复
热议问题