After some more research I have come to the conclusion that it is
impossible to change the background drawable of the menu ( In Version
SDK 1.1 ).

Proof of that can be found in

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/com/android/internal/view/menu/MenuBuilder.java;h=cbc4e9f950a6a881c9e9c13dc45056534f64bfdc;hb=HEAD

More precisely : If the menutype is TYPE_ICON ( the regualr menu with
icons that comes up when you press the menu-key on the android dev
phone e.g.)
the following theme will always be used:

Theme_IconMenu or Theme.IconMenu

This is hardcoded in the android framework internals here:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/values/themes.xml;h=3f07e70b907a065d6a4017eb058e7ea085426075;hb=HEAD#l336


So, I am pretty sure that the "selector"-drawable for the icon menu
can not be changed.

You can actually set the itemBackground value for the the extended
menu
( The one that will be used when you have more menu items than the max
that can be displayed normally. [Try putting about 20 MenuItems  in a
menu to see what i mean])

But I think that's really a hack which kind of exploits something that
ppl at google forgot to switch off...

@googlemployees:

- You might want to switch off the ability to change the extended menu
selector ... Right now I set the selector by applying the following
theme to my app in the AndroidManifest :

<resources>
    <style name="CustomTheme">
     <item name="android:itemBackground">@drawable/my_menu_selector</
item>
  </style>
</resources>

- The other thing that I wonder about is wether it is a good idea to
not allow developers to change the menu. I understand that it makes
sense
for consistency but I also feel that the menu is "inside" my
application and that I should have the control over its visual design!

- I guess I could intercept the menu button's key event and just code
my own menu, but that seems a bit too much of an effort :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to