Open AymenBoukhari opened 7 months ago
cascade
should be usable from Java. Can you share what have you tried so far?
cascade
should be usable from Java. Can you share what have you tried so far?
i tried this but it just gives me the default menu do i need to change something in the xml files?
private void showMenu(View v, @MenuRes int menuRes) { Context context = v.getContext(); popup = new CascadePopupMenu(context, v); popup.inflate(R.menu.popup_menu);
int i = 0;
for (String menuItemData : menuItemDataList) {
popup.getMenu().add(Menu.NONE, i, Menu.NONE, menuItemData);
i++;
}
popup.setOnMenuItemClickListener(new androidx.appcompat.widget.PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
button.setText(item.getTitle().toString());
return true;
}
});
// Show the popup menu.
popup.show();
}
i have the same problem
Hi, i just want to use this menu on my java code
<?xml version="1.0" encoding="utf-8"?>
private void showMenu(View v, @MenuRes int menuRes) { Context context = v.getContext(); popup = new PopupMenu(context, v); popup.getMenuInflater().inflate(menuRes, popup.getMenu());