سؤال

In my ActionMode I disable and enable the MenuItems of a CAB depending on some conditions like:

        if (isConditionMet)) {
        MenuItem[] fileActionsToLock = { mMenu.findItem(R.id.action_share),
                mMenu.findItem(R.id.action_rename),
                mMenu.findItem(R.id.action_copy),
                mMenu.findItem(R.id.action_move) };
        for (MenuItem i : fileActionsToLock) {
            i.setEnabled(false);
        }

I would like to also disable those CAB MenuItems visually, e.g. something like changing the alpha value of their CAB icons. Is there any way to do this without actually replacing the icons by calling setIcon()?

هل كانت مفيدة؟

المحلول

never mind, I just figured out to use mMenuItem.getIcon().setAlpha(xxx); This will actually work for any kind of Menu (I guess).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top