我想制作一个来自操作栏的弹出菜单。因此,不是操作栏中的图标,而是会显示菜单,然后单击时会触发此弹出窗口。这可能吗?
private void showPopupMenu(View v){
popupMenu= new PopupMenu(menuActivity.this, v);
popupMenu.getMenuInflater().inflate(R.menu.action_menu, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return true;
}
});
popupMenu.show();
}