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
>

-- 
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