I created a PopupMenu that shows up when I click a button but it shows a list of menu items. I want to know if there is a way to make it grid instead of list.
button = (Button) findViewById(R.id.menu_btn);
final PopupMenu popupMenu = new PopupMenu(MainActivity.this, button);
popupMenu.getMenu().add("item 1");
popupMenu.getMenu().add("item 2");
popupMenu.getMenu().add("item 3");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupMenu.show();
}
});
You could create a custom
PopupWindowlayout that is exactly what you want and inflate it before theshow()function. Here http://developer.android.com/guide/topics/ui/menus.html#PopupMenu or here How to create a custom PopupMenu in Android you could find some examples.