0

I have one activity with 3 fragments. I want to hide menu which is created in activity and show the fragment 2 alone.

I know how to hide menu which is created by other fragments. Is it possible to hide the Activity menu on fragments?

gung - Reinstate Monica
  • 11,583
  • 7
  • 60
  • 79
Asthme
  • 5,163
  • 6
  • 47
  • 65

1 Answers1

0

When you override onCreateOptionsMenu you can clear the menu from there.

@Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        menu.clear();

        inflater.inflate(R.menu.menu, menu);

        super.onCreateOptionsMenu(menu, inflater);

}
MrEngineer13
  • 38,642
  • 13
  • 74
  • 93
  • i will try and let u know – Asthme Jul 16 '14 at 13:48
  • ya it helped me ,btw is it possible to animate on action bar while chaging menus by clearing default one and creating a new one for fragment.... – Asthme Jul 16 '14 at 15:42
  • You can animate them http://stackoverflow.com/questions/9731602/animated-icon-for-actionitem but instead of rotating them you could make them fade out or something like that. – MrEngineer13 Jul 16 '14 at 15:51