I am trying to hide the title part of my actionbar using ActionBarSherlock like in the second picture:
Setting:
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
works for versions >3.0 but doesn't work on older versions. A black space remains over the tab bar.
Is there a workaround to solve that issue?
This feature is only available in ActionBarSherlock 4.0 which is currently in beta stage. You can find a link to the betas on actionbarsherlock.com.
There is a demo for precisely what you are trying to accomplish in the samples for 4.0.
public class TabNavigationCollapsed extends SherlockActivity implements ActionBar.TabListener {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab = getSupportActionBar();
//The following two options trigger the collapsing of the main action bar view.
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayShowTitleEnabled(false);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ab.addTab(ab.newTab().setText("Tab 1").setTabListener(this));
ab.addTab(ab.newTab().setText("Tab 2").setTabListener(this));
ab.addTab(ab.newTab().setText("Tab 3").setTabListener(this));
}
@Override public void onTabReselected(Tab tab) {}
@Override public void onTabSelected(Tab tab) {}
@Override public void onTabUnselected(Tab tab) {}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With