How to set a long click listener on a MenuItem (on a NavigationView)?
问题 How can I set a long click listener on a MenuItem ? I tried this answer, but the method doesn't exist for me. Any solutions? Code: Menu menu = navigationView.getMenu(); MenuItem menuItem = menu.findItem(R.id.menu_item); // TODO set a long click listener on the menuItem. menuItem.setOnLongClickListener(...); // Method does not exist, any other solutions? Edit: I don't want to set a custom ActionView, I want the long click listener to the whole MenuItem , without a custom View. 回答1: one of many