Hi guys I need to initiate PopupMenu from a button that is inside another popupWindow, the problem is that when i\'m placing this button inside activity\'s root view it work
Finally i found the solution by a little trick and i'm sharing it so if someone need it. My solution isn't so great but it works without any visual difference and problem, so maybe it help in some case. I created one button in main xml file and in exact same place with the original button in PopupWindow, and in PopupMenu code I replaced v with reference for invisible button, here is my code:
public void showSettingsPopup2(View v) {
PopupMenu popup = new PopupMenu(getBaseContext(), findViewById(R.id.IVoptionsMenuInvis));
popup.setOnMenuItemClickListener(this);
popup.getMenuInflater().inflate(R.menu.main, popup.getMenu());
popup.show();
}
You can't anchor a PopupMenu to a view in a PopupWindow. You will need to anchor it to a View in a top-level window.