Hide action bar menu items from invisible fragment
<p>I use 3 FrameLayouts in my activity view xml into which I dynamically insert different fragments. Many of these fragments contribute ActionBar MenuItems. Now I have a situation where I hide a FrameLayout (set visibility to View.GONE) and therefore the Fragment in it becomes invisible. However it still contributes the menu item since the fragment does not to seem to be paused or anything so I cant seem to call a method that actively hides the action bar item.</p>

<p>As a solution I now just insert a fragment into the FrameLayout that has no menu item when I switch the FrameLayout to invisible. While that works it feels like a hack to me. What is the proper way to hide any action bar menu items? What states does the fragment go into if I just hide the layout it is in? </p>

<p>I am doing all this with the compatibility library r6 in case that matters.</p>
