Tabs with ActionBarSherlock and Fragments with Top

2019-08-01 05:49发布

问题:

I am implementing the same design as described here: Android ActionBarSherlock Top Bar and using the accepted answers code. Although it is pushing my nav bar below my tabs:

Valid XHTML http://img255.imageshack.us/img255/8908/tabsa.png.

Any idea why?

回答1:

Its a bug with ActionBarSherlock (from https://github.com/JakeWharton/ActionBarSherlock/issues/327 ).

Cause:

When you call setDisplayShowHomeEnabled(false) in onCreate() and are using a tab navigation mode, the tabs will appear above the action bar as opposed to below it.

Workaround:
Remove the setDisplayShowHomeEnabled call, and add this instead:

View homeIcon = findViewById(android.R.id.home);
((View) homeIcon.getParent()).setVisibility(View.GONE);