How to make any imagebutton a menu button
How to make any imagebutton a menu button I have an imageButton in a xml file. Now want to make it a menu button, so that when a user click on the button it should show the drop down menus. But I am not able to figure out what are the possible solution(s). Can anyone help? 2 Answers 2 If you're trying to show a drop down menu when clicking an ImageButton (or any other View ), try this: final ImageButton imageButton = // get your ImageButton from the XML here final PopupMenu dropDownMenu = new PopupMenu(getContext(), imageButton); final Menu menu = dropDownMenu.getMenu(); // add your items: menu.add(0, 0, 0, "An item"); menu.add(0, 1, 0, "Another item"); // OR inflate your menu from an XML: dropDownMenu.getMenuInflater().inflate(R.menu.some_menu, menu); dropDownMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuIte...