7

The options menu has a translucent background and I would like to make it solid and non-transparent. Is there a way?

Sathish Kumar
  • 919
  • 1
  • 13
  • 27
Don
  • 71
  • 1
  • 1
  • 2

4 Answers4

4

Try this:

<style name="MyTheme" parent="android:Theme">
     <item name="android:panelFullBackground">{your color or drawable}</item>
</style>

Also, see:

Community
  • 1
  • 1
æ-ra-code
  • 2,140
  • 30
  • 28
2

Try this for android 4.0:

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

    <style name="MyPopupMenu" parent="@android:style/Widget.DeviceDefault.ListPopupWindow">
        <item name="android:popupBackground">{your color or drawable}</item>
    </style>

Also, the following site generate Action Bar Style :

http://jgilfelt.github.com/android-actionbarstylegenerator/

Salman666
  • 81
  • 3
2

set android:theme="myTheme", and define your own theme with whatever colours you want. Read up about Styles, and look at the android themes.xml.

fredley
  • 32,953
  • 42
  • 145
  • 236
0

If you don't want to style a whole theme and just change the options menu background then set the panelFullBackground property to a DRAWABLE RESOURCE of your liking. Setting it to a color directly doesn't work so either make one coloured - 9patch, if you want to save in size -image and set it to that or make a couple and make a selector drawable with an image for each state.

I put my definition in a style that i use for all the activities in my project using:

@drawable/optionsmenu_back

optionsmenu_back being a 9patch image with a solid colour...

EeKay
  • 6,494
  • 3
  • 24
  • 24