title: Menu not visible in Fragment
body: <p>I have a fragment that contains menu I have tried calling    <code>setHasOptionsMenu(true);</code> in both <code>onCreate()</code> as well as <code>onCreateView()</code> and set a <code>toolbar</code> as my <code>Actionbar</code>. I have gone  through all the questions about the same here but none of the solutions seem to be working for me! I have tried changing the theme, menu.clear(), and returning true from <code>onCreateOptions()</code> of the Activity</p>
  
  <pre><code>    @Override
      public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setHasOptionsMenu(true);
  
              }
  
  
              @Override
              public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                       Bundle savedInstanceState) {
  
                  setHasOptionsMenu(true);
  
                  // Inflating view layout
  
                  layout = inflater.inflate(R.layout.side_panel, container,false);
                  toolbar = layout.findViewById(R.id.toolbar);
  
                  ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
  
  
                   return layout;
              }
  
  
              @Override
              public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
                  super.onCreateOptionsMenu(menu, inflater);
                  inflater.inflate(R.menu.menu_side_panel,menu);
              }
  
              @Override
              public boolean onOptionsItemSelected(MenuItem item) {
                  return super.onOptionsItemSelected(item);
              }
  
              @Override
              public void onActivityCreated(@Nullable Bundle savedInstanceState) {
                  super.onActivityCreated(savedInstanceState);
              }
  </code></pre>