Search code examples
tabsactionbarsherlock

Tabs are above my sherlock action bar


I use ActionBarSherlock. Everything would be OK if my action bar were above the tabs.

public class MyList extends SherlockListActivity implements ActionBar.TabListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.countries_list);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        // Inflating tabs and views

    }

    // onTab methods
}

Screetshot


Solution

  • This is a bug in the framework that was only fixed in Android 4.2. ActionBarSherlock displays the same behavior as Android 4.0 for consistency. Even if it was fixed in ABS you'd still see this broken behavior on 4.0 and 4.1 in your apps.