Search code examples
androidandroid-actionbaractionbarsherlock

Action bar being shown below its tabs


When i set these attributes:

    actionBar = getSupportActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Title");
    actionBar.setLogo(null);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

The ActionBar is below its Tabs.

But if i comment this Like:

actionBar.setDisplayShowHomeEnabled(false);

It works fine. But the reason i want it to be false is, to avoid the appIcon being shown.

Thank You


Solution

  • I googled this problem and found this thread on gitub: https://github.com/JakeWharton/ActionBarSherlock/issues/327

    You can read the thread, but the conclusion is:

    Hi. Just found a simple workaround.

    Use the following in your onCreate method :
    View homeIcon = findViewById(android.R.id.home);
    ((View) homeIcon.getParent()).setVisibility(View.GONE);
    this collapses the home button completely.

    PS : i'm using standard ActionBar but this should work the same

    I hope this helps you out,
    Daniel.