how can I get the View Anchor for a PopupMenu if the corresponding MenuItem in ActionView is not shown as Action:
if (item.getItemId() == R.id.myMenu) {
PopupMenu popupMenu = new PopupMenu (this, findViewById(R.id.myMenu));
popupMenu.show();
return true;
}
<item
android:id="@+id/myMenu"
appcompat:showAsAction="never"
android:title="@string/sharePage"
android:icon="@drawable/navigation_share"/>
If appcompat:showAsAction="always"
everything works fine, but with
appcompat:showAsAction="never"
the Method findViewById(R.id.myMenu)
returns null.