My question is stupid I know, but i have no single idea how to solve that problem.
I followed Android API and perfectly made Split Action Bar, without problem.
http://developer.android.com/guide/topics/ui/actionbar.html#SplitBar
But when i decided to remove activity icon action bar drops down under the tabs and i can not find out why.
actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
//actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setTitle("Contacts");
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
After I remove comment (remove Icon respectivaly), tabs get up and bar gets down.
Related
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
Have you tried for actionBar.setDisplayShowHomeEnabled(false)
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)
I've been trying to remove this bar (cant hotlink images, yet, check next link):
http://i.imgur.com/fRvMW.png
But I can't achieve it.
Tried the following:
Added into manifest the following:
android:theme="#android:style/Theme.NoActionBar"
But resulted as crash. Probably because I don't have this "Theme". I can't find out what should I write here.
Also tried to remove manually on each Fragment by Graphical Layout, selecting "No action bar", and it doesn't show up on the "preview" but it's shown in the app, probably because its the wrong place to configure it.
Note that it's with fragments. I searched about doing it by code, but I just found options to do it for activities.
So, my question is: How can I hide the App Action bar?
Edit:
SOLVED
On my code, I've this:
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
So, just added:
bar.hide();
And everything is working. Even if the tabs names aren't shown, the navigation still works (Swaping right and left for swapping fragments.)
Have you tried this?
ActionBar actionBar = getActionBar();
actionBar.hide();
I am using Action bar with Tabs. I want to hide app icon from action bar. I use the below code, but action bar is showing below Tabs. Both are not useful for me.
Any one help me!
actionBar.setDisplayUseLogoEnabled(false);
and
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayUseLogoEnabled(false); should do it.
add
actionBar.setDisplayShowTitleEnabled(false)
I am trying to remove the title from my action bar and reclaim the space it would otherwise consume for the use of menu items.
I have tried using a custom theme but so far nothing has worked. I have tried changing the text size to 0sp, changing the color to transparent, and setting visibility to gone.
I have also tried this :
ActionBar actionbar = getActionBar();
actionbar.setDisplayShowTitleEnabled(false);
I am targeting sdk 15+ and using the standard Android action bar (i.e. not Sherlock).
Thanks for any suggestions.
Here's what I'm talking about (the area bordered in red I want back):
Did you check out the ActionBar documentation yet? There's a method, setDisplayShowTitleEnabled(boolean) that does what you need.
Simply get a reference to your ActionBar, and call that with false:
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
Is it possible to remove title bar which I think is ugly and doesn't fit in my application but still use actionbar? After I call
requestWindowFeature(Window.FEATURE_NO_TITLE | Window.FEATURE_ACTION_BAR);
the title bar stays but piece of my view is gone(cant scroll up)
Is it possible to get rid of title bar but still keep actionbar, if I dont request it as window feature getActionBar() returns null everytime..
Following Honeycomb, Action Bar was introduced to provide more functionalities, Well you can hide logo and title from it using this
ActionBar ab = getActionBar();
ab.setDisplayShowTitleEnabled(false);
ab.setDisplayShowHomeEnabled(false);