We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, i just want to use this menu on my java code
private void showMenu(View v, @MenuRes int menuRes) { Context context = v.getContext(); popup = new PopupMenu(context, v); popup.getMenuInflater().inflate(menuRes, popup.getMenu());
int i = 0; for (String menuItemData : menuItemDataList) { popup.getMenu().add(Menu.NONE, i, Menu.NONE, menuItemData); i++; } popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { button.setText(menuItem.getTitle().toString()); return true; } }); popup.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { // Respond to popup being dismissed. } }); // Show the popup menu. popup.show(); }
The text was updated successfully, but these errors were encountered:
cascade should be usable from Java. Can you share what have you tried so far?
cascade
Sorry, something went wrong.
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
No branches or pull requests
Hi, i just want to use this menu on my java code
private void showMenu(View v, @MenuRes int menuRes) {
Context context = v.getContext();
popup = new PopupMenu(context, v);
popup.getMenuInflater().inflate(menuRes, popup.getMenu());
The text was updated successfully, but these errors were encountered: