title: How to change the position of menu items on actionbar
body: <p>I'm developing one application in which I have to add a custom layout on actionbar. Adding the custom layout is done, but when I'm adding the menu items on actionbar my custom layout changes it's position from right of the actionbar to center of the actionbar. Below is the image what I have achieved so far.</p>
  
  <p><img src="https://i.stack.imgur.com/wERrp.png" alt="Done till here"></p>
  
  <p>I want something like this on the actionbar.</p>
  
  <p><img src="https://i.stack.imgur.com/5colE.png" alt="Like this"></p>
  
  <p>Custom layout(yellow button) at the right most part of actionbar and menu items in the middle.</p>
  
  <p>Adding my code to achieve this custom layout using native android actionbar:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      getActionBar().setDisplayHomeAsUpEnabled(true);
      getActionBar().setHomeButtonEnabled(true);
  
      actionBar = getActionBar();
      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setDisplayUseLogoEnabled(false);
      actionBar.setDisplayHomeAsUpEnabled(false);
      actionBar.setDisplayShowCustomEnabled(true);
      cView = getLayoutInflater().inflate(R.layout.header, null);
      actionBar.setCustomView(cView);
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.websearch_menu, menu);
      return true;
  
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      switch (item.getItemId()) {
  
      case android.R.id.home:
          finish();
  
      default:
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>How can this be achieved?</p>
  
  <p>Any kind of help will be appreciated.</p>