Android disable cliking sound menu

I can turn off the button click sound on a button if I use android:soundEffectsEnabled="false"

in my layout.

I want to turn off the sound effect for the Action Bar element. This attribute has no meaning.

How to disable clicking when the user selects a menu item

+3


source to share


1 answer


I am using this:

    final Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    final View child = toolbar.getChildAt(2);
    if (child instanceof ActionMenuView)
    {
        final ActionMenuView actionMenuView = ((ActionMenuView) child);
        actionMenuView.getChildAt(actionMenuView.getChildCount() - 1).setSoundEffectsEnabled(false);
    }

      



If the navigation drawer uses toolbar.getChildAt (2); if you don't use toolbar.getChildAt (1);

0


source







All Articles