I have been learning Action Bar, I want the top menu to have Tabs + One Refresh button. So, I have tried to make a simple menu with one button:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("Refresh")
.setIcon(R.drawable.abs__ic_search_api_holo_light)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
And adding tabs:
mViewPager = new ViewPager(this);
mViewPager.setId(R.id.pager);
setContentView(mViewPager);
ActionBar bar = getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayShowTitleEnabled(false);
bar.setDisplayShowHomeEnabled(false);
mTabsAdapter = new TabsAdapter(this, mViewPager);
mTabsAdapter.addTab(bar.newTab().setText("Grades"), FragmentOne.class, null); // many more tabs in same format
However the problem is when the app is in portrait mode, the menu bar goes to a level below. When in Landscape mode it is more acceptable, however it groups them into pull down list. I have read Android’s ActionBar but could not find a solution. What is the workaround this? I only want the Tabs to be scrollable to left-right, and refresh button static at right. Do I need to make a layout and inflate it somehow?


This is a known bug, see this conversation: https://groups.google.com/forum/#!topic/actionbarsherlock/wYuKJUdO1vs/discussion
There is also feedback and a little workaround by Jake Wharton himself, but I don’t think it will help you a lot (since you want the tabs, not the spinner).
This solution may be more helpful for you: https://stackoverflow.com/a/13828869/1140682