I'm new in creating Android apps, and I would like to hide the Title, App Icon, and the whole top area of the ActionBar, but keep the Tabs Navigations below it. Is it possible?
Here is an explanation picture about what I want exactly:
This will show only tabs:
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
// Set your tabs below
Related
I know how to implment ActionBar with back button. But I want to make ActionBar invisible or with no background, I want to have only visible back button arrow. Is it possible?
With a little of search you will find the response. Any way you can try this :
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00000000")));
If you want to have your tab background below your ActionBar add this too :
actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#00000000")));
I need add a image in between navigation button and drop-down in action-bar.How can I do this?
you need to call setIcon() it will change the icon
getActionBar();
ActionBar actionBar = getActionBar();
actionBar.setIcon(R.drawable.my_icon);
see this for more detail
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 add tabs and viewpager to my project.
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Everything is perfect until i set custom view of actionBar:
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
....
actionBar.setCustomView(vv,layoutParams);
Perfect: ActionBar itself at the top and tabs are below the actionBar.
When i set the custom view, tabs change place and goes to top and actionBar goes to below of tabs.
What am i doing wrong? I want the actionbar stay always at the top of the screen.
You can vote for this bug on Android code:
https://code.google.com/p/android/issues/detail?id=36191
There are some tricks to avoid this that you can read here: https://github.com/JakeWharton/ActionBarSherlock/issues/327
But the official Google answer is
This is a working as intended UX decision.
(Roman Nurik).
I'm using sherlockbar. How do I add a ActionBar bar with tabs and a navigation list? As this image from Google Maps
In my code, I can not seem to set two behaviors for ActionBar
ActionBar bar = getSherlockActivity().getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
the opt navigation (Meus Lugares) are added using the menu onCreateMenu .
The other are Tabs which you add using
bar.AddTab()