Hiding the title of an actionbar doesn't work on older versions of Android (using ActionBarSherlock)

I am trying to hide the title part of my actionbar using ActionBarSherlock like in the second picture:
enter image description here

Setting:

  • Complete list of all Android resource folders?
  • Dynamically adjusting widget's content and layout to the size the user defined through resize. Android
  • How to obfuscate my android project in eclipse IDE?
  • Hiding/Showing the toolbar when fragment in the tabs is scrolled
  • android: how to add children from an xml layout into a custom view
  • Calling into a saved java object via JNI from a different thread
  • 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?

    Related posts:

    Using Intent in an Android application to show another activity
    How to create a notification with NotificationCompat.Builder?
    Android Spinner.setSelection() doesn't work
    How to set margin dynamically in Android?
    Safe usage of glMapBufferRange() on Android/Java
    Background drawables define view size
  • User Notifications - How to recover a lost notification_id from GCM?
  • How to change the background color of a saved transparent bitmap
  • CPU usage per application in android
  • Unable to execute dex: Multiple dex files define
  • Smooth scroll and Fling with NestedScrollView,AppBarLayout and CoordinatorLayout
  • Google Places API request denied for Android autocomplete, even with the right api key
  • 2 Solutions collect form web for “Hiding the title of an actionbar doesn't work on older versions of Android (using ActionBarSherlock)”

    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) {}
    }
    

    You can try with this, it worked for me

    if (android.os.Build.VERSION.SDK_INT <= 10) {
            setTheme(R.style.Theme_Mo);
        }
    

    or

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    Hope that this helps

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.