Since android 4.2 now support NestedFragment , and added it to support v13.
I use this NestedFragment on a classic situation : Create fragmentA that can swipe left and right and consume a majority of the screen space, and insert fragmentB and fragmentC into each fragment page.
My Problem is the MenuItem I create in fragmentB and fragmentC can`t show on Activity`s actionbar.Which before I use NestedFragment , it works well.
got at some point the same problem. If you're using the ActionBarSherlock library this is a small bug. What you basically have to do is to call from your parent fragment from the onCreateOptionsMenu() method the onCreateOptionsMenu() method of the children, something like:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
getChildFragment().onCreateOptionsMenu(menu, inflater);
}
hope this works, let me know.
Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With