OK, I ended up generating "disabled" looking images for Honeycomb myself on the fly. Not a best solution, but it works.
On Nov 15, 10:13 am, port443 <[email protected]> wrote: > I'm loading images myself from an APK loaded via ClassLoader, so I > seem not having access to Resources class. > > So, I tried building StateListDrawable on the fly: this seems to work > (two files instead of three!). > > Yes, icons required for different menu styles should be different, but > our graphics designer made 32x32px images which look good on both old- > style and new-style menus (Moto XOOM; mdpi). > > On Nov 14, 12:06 pm, Kostya Vasilyev <[email protected]> wrote: > > > > > > > > > I just tried it out on 3.2 with same results: the action bar item text > > gets automatically grayed out, the icon does not. > > > You could put the new state-list drawables in res/drawable-v11, but yes, > > I agree it's a pain... But you know, those icons now have very different > > sizes from before anyway... > > > -- Kostya > > > 14.11.2011 20:51, port443 : > > > > Yeah, this may be a way out. But I don't like it: classic menus work > > > proving that the "graying" code is already there; making three files > > > for every toolbar image is pain :( it also makes old/new styles > > > incompatible. > > > > On Nov 14, 11:37 am, Kostya Vasilyev<[email protected]> wrote: > > >> Perhaps you need a good and proper state list drawable with > > >> state_enabeld=false? > > > >> ( wherease the old-style menus automatically produce disable images as > > >> needed ) > > > >> -- Kostya > > > >> 2011/11/14 port443<[email protected]> > > > >>> Yes, this is what I have to do for ActionBar to get refreshed. > > >>> I have menu empty initially and then load my items with a call to > > >>> Activity.invalidateOptionsMenu(); so I definitely know this works. > > >>> I have one of menu items disabled (tapping on it does not produce any > > >>> effect), but it looks as enabled so there's no user feedback (i.e. > > >>> user has to tap on it to find out it is disabled); same code works on > > >>> same device with classic menus and makes menu items look disabled (if > > >>> I just change target platform 11 -> 10). > > >>> On Nov 14, 10:46 am, Kostya Vasilyev<[email protected]> wrote: > > >>>> Have you tried invalidateOptionsMenu? (iirc) > > >>>> -- > > >>>> Kostya Vasilyev > > >>>> 14.11.2011 18:58 "port443"<[email protected]> : > > >>>>> I'm having trouble making an ActionBar's menu item look disabled. > > >>>>> This works well for pre-Honeycomb (popup) menus correctly, but doesn't > > >>>>> work on new menus. > > >>>>> I'm making items appearing on ActionBar itself (which looks like a > > >>>>> toolbar); disabled items cannot be pressed, yes, but they are not > > >>>>> grayed out as on older popup menus. > > >>>>> @Override > > >>>>> public boolean onPrepareOptionsMenu(Menu menu) > > >>>>> { > > >>>>> menu.clear(); > > >>>>> for (ToolbarButton b : _current.getButtons()) > > >>>>> { > > >>>>> MenuItem mi = menu.add(b.title); > > >>>>> mi.setEnabled(b.enabled); //<-- this doesn't change > > >>> image > > >>>>> color > > >>>>> mi.setIcon(b.image.mutate()); > > >>>>> mi.setOnMenuItemClickListener(b); > > >>>>> if (android.os.Build.VERSION.SDK_INT> 10) > > >>> mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); > > >>>>> } > > >>>>> } > > >>>>> Any way to make it working? Or Honeycomb UI supposes that such items > > >>>>> should merely disappear? > > >>>>> TIA. > > >>>>> -- > > >>>>> 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 > > >>> -- > > >>> 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 > > > -- > > Kostya Vasilyev -- 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

