Search code examples
androidmenuactionbarsherlockandroid-tabs

Show Only tabs and menu at the bottom using Actionbarsherlock


I have been able to remove the top bar and show only the tabs using this code

    final ActionBar ab = getSupportActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ab.setDisplayHomeAsUpEnabled(false);
    ab.setDisplayUseLogoEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayOptions(0);

And I create menu with this

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getSupportMenuInflater().inflate(R.menu.menu_main, menu);
    return super.onCreateOptionsMenu(menu);
}

I also have added this in the relevant activity of AndroidManifest.xml

        android:uiOptions="splitActionBarWhenNarrow"

But both menu and the tab list come on different lines at the top. Is there a way to bring them in single row ? Or take down the menu at the bottom ? enter image description here


Solution

  • According to this https://stackoverflow.com/a/13641950/480577 the Action bar will not split for devices having a available width of 480dp and more. And I was trying this on a tablet. On a smaller phone it was showing as expected.