0

I want a custom ActionBar with Tabs that has a graphic background (displaying just one image) and 3 tabs.
I can't remove the icon of the actionbar.I've been through tens of stackoverflow questions about how to remove the icon and title, but nothing worked. I have a minSdk=14, ViewPager, ActionBar compat7, ActionBarActivity. Would any of these hinder it?

This is the code I have. Some declarations are excessive, I've been trying everything I could.
The best I got is an actionbar with no title, but the icon never goes away.

final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setHomeButtonEnabled(false);

actionBar.setDisplayShowHomeEnabled(false); // this hides the icon well but doesn't
                                          // work if you use actionbar tabs (viewpager)

solution below

Thanks

not_this_again
  • 187
  • 2
  • 9
  • see http://stackoverflow.com/questions/5720715/remove-application-icon-and-title-from-honeycomb-action-bar and http://stackoverflow.com/questions/14606294/remove-icon-logo-from-action-bar-on-android – Shayan Pourvatan Jan 03 '14 at 18:38

2 Answers2

0

Have you tried for actionBar.setDisplayShowHomeEnabled(false)

Renan Bandeira
  • 3,238
  • 17
  • 27
  • Yes, that does solve the problem actually but due to a bug or strange design, the tabs go above the actionbar (in case you're using a viewpager). Posting a workaround solution below – not_this_again Jan 03 '14 at 19:06
0

The solution is this:

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

as seen on: https://github.com/JakeWharton/ActionBarSherlock/issues/327#issuecomment-10593286

Using actionBar.setDisplayShowHomeEnabled(false) hides the icon, but your actionbar ends up being below the viewpager tabs (if you're using any)

not_this_again
  • 187
  • 2
  • 9
  • ActionSherlock .. Was not recommended by JackeWharton ....http://jakewharton.com/deprecated-from-inception/ – Gowtham Kumar Jan 04 '14 at 11:47
  • @ursgtm, I'm not using ActionBarSherlock. I'm using the Google Compat7 library. It seems that the issue exists natively as well as on sherlock... – not_this_again Jan 09 '14 at 17:10