5

I am using Theme.Holo in My Current android app.

enter image description here

Above is the overflow UI from my current theme.

I want to customize overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64).

Following is the style.xml I am using

<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
    <item name="android:actionBarStyle">@style/CustomActivityTheme.ActionBar</item>
    <item name="android:actionMenuTextColor">#000000</item>
    <item name="android:divider">@drawable/action_bar_div</item>
    <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>

<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
    <item name="android:src">@drawable/overflow</item>
</style>

<style name="CustomActivityTheme.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/actionbar_bg</item>
    <item name="android:titleTextStyle">@style/CustomActivityTheme.ActionBar.Text</item>
    <item name="android:subtitleTextStyle">@style/CustomActivityTheme.ActionBar.Text</item>
</style>

<style name="CustomActivityTheme.ActionBar.Text" parent="@android:style/TextAppearance">
    <item name="android:textColor">#000000</item>
    <item name="android:textSize">16sp</item>
</style>

<style name="activated" parent="android:Theme.Holo">
    <item name="android:background">?android:attr/activatedBackgroundIndicator</item>
</style>

<!-- style for removing the floating dialog -->
<style name="CustomDialogTheme">
    <item name="android:windowIsFloating">false</item>
    <item name="android:windowNoTitle">true</item>
</style>

<!-- style for transparent image resource  activity -->

<style name="Theme.Transparent" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:windowAnimationStyle">@style/MyAnimation.Window</item>
</style>

<!-- Animations for a non-full-screen window or activity. -->
<style name="MyAnimation.Window" parent="@android:style/Animation.Dialog">
    <item name="android:windowEnterAnimation">@anim/grow_from_middle</item>
    <item name="android:windowExitAnimation">@anim/shrink_to_middle</item>
</style>

<!-- style for transparent audio and video resource  activity -->

<style name="Theme.Transparent_Player" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:windowAnimationStyle">@style/MyPlayerAnimation.Window</item>
</style>

<!-- Animations for a non-full-screen window or activity. -->
<style name="MyPlayerAnimation.Window" parent="@android:style/Animation.Dialog">
    <item name="android:windowEnterAnimation">@anim/grow_from_action_bar</item>
    <item name="android:windowExitAnimation">@anim/shrink_to_action_bar</item>
</style>

How can I customize theme to match overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64) in above code?

Thanks in advance..

Jonik
  • 80,077
  • 70
  • 264
  • 372
Akbari Dipali
  • 2,173
  • 1
  • 20
  • 26
  • Hope these link help you up--> http://jgilfelt.github.com/android-actionbarstylegenerator/#name=example&compat=holo&theme=light&actionbarstyle=solid&backColor=57534b%2C100&secondaryColor=D6D6D6%2C100&tertiaryColor=F2F2F2%2C100&accentColor=33B5E5%2C100 – Vikalp Patel Jan 07 '13 at 09:33
  • I have tried this link but i didn't get the output that i want. It was overriding other styles i specified – Akbari Dipali Jan 07 '13 at 09:43

3 Answers3

5

to change text color you can use :

<item name="android:textAppearanceLargePopupMenu" >@style/m_textAppearanceLargePopupMenu</item>

<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>

 <style name="m_textAppearanceLargePopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
        <item name="android:textColor">#FFF</item>
    </style>

    <style name="m_textAppearanceSmallPopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
        <item name="android:textColor">#FFF</item>
    </style>

this will change the popup menu text color to white

Mohammad Ersan
  • 12,304
  • 8
  • 54
  • 77
  • This was also the fix for my issues with having a light actionbar and relying on the default (normally black, but white in lollipop - which made the text unreadable) text color. – Paul Ruiz Dec 01 '14 at 20:42
3

Try this:

<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
    ...
    <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
    ...
</style>

<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:background">#f5fdef</item> 
</style>

I found it at this post

Andy McSherry
  • 4,676
  • 3
  • 26
  • 36
  • It changed the background color of my popup window but to set the font color to RGB (64, 64, 64) i have write @style/MyDropDownListView and but it isn't changing the color. Any idea? – Akbari Dipali Jan 07 '13 at 09:54
  • 1
    Yoel - The question doesn't ask about the AppCompat theme so this answer doesn't address it. You should probably open a different question that relates better to your needs. – Andy McSherry Jun 03 '14 at 20:24
  • can we do it on a spinner ? – ralphgabb May 15 '15 at 05:46
0
<style name="MyActionBar3" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="android:background">@color/ActionBarBackground</item>         
</style>

<style name="MyActionBarDropDownStyle" parent="">
    <item name="android:background">#00FF00</item>        
    <item name="android:divider">#ff0000</item>
    <item name="android:dividerHeight">1dp</item> 
    <item name="android:textColor">#FFFFFF</item>     
    <item name="android:textSize">10sp</item>
</style>

<style name="MyTextStyle" parent="@style/Widget.AppCompat.Light.Base.ListPopupWindow">
    <item name="android:popupBackground">#FF0000</item>        
</style>

Apply the style to android:textAppearanceLargePopupMenu" item's attribute