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()
Related
I am using Custom Action bar. For which the code i am using is -
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getActionBar().setCustomView(R.layout.custom_home_action_bar);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(
R.color.color_dark_blue)));
but when I use this code to customise my action bar, navigation drawer icon is not shown. When I comment these lines it is perfectly shown but then I cannot customise my action bar.How can i achieve both?
Thanks in advance
I got the solution. I used
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
instead of
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
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
I am trying to implement ActionBarSherlock with three tabs in the way that the tabs are placed in the same line as HomeButton. See the picture below:
I created the ActionBarSherlock and added the three tabs but they did not appear on the screen. What did I miss?
Here is my code:
//ActionBarSherlock settings
ActionBar actionBar=getSupportActionBar();
Resources res=getResources();
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setLogo(res.getDrawable(R.drawable.logo));
actionBar.setSplitBackgroundDrawable(res.getDrawable(R.drawable.separator));
actionBar.setBackgroundDrawable(res.getDrawable(R.drawable.navbar));
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
//Tabs
actionBar.addTab(actionBar.newTab().setText("apps").setIcon(R.drawable.ico_apps_normal).setTabListener(this).setTag("apps tab"),true);
actionBar.addTab(actionBar.newTab().setIcon(R.drawable.ico_add_normal).setTabListener(this).setTag("add tab"));
actionBar.addTab(actionBar.newTab().setIcon(R.drawable.ico_news_normal).setTabListener(this).setTag("news tab"));
Try adding
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
before you start adding your tabs. It seems like you haven't set your navigation mode.
I've also answered a similar question regarding Actionbars and navigaton tabs here
In my app I have ActionBar with tabs and I want to make tabs translucent, but not ActionBar. Is it possible to achive this via styles and themes?
You can use custom layout and inflate it to use it as tabs
Please find it here : https://stackoverflow.com/a/10013297/951045
and to hide actionbar use
getSupportActionBar().hide(); // if you are using support lib
otherwise use getActionBar().hide();
You can also hide actionbar by using Theme.Sherlock.NoActionBar (for support lib)
Hi everyone I am working currently a view which need to have a view above the tabs of the actionbar or more like below the action bar itself, and a fixed footer between the tabs.
But I have not find a way to make this behaviour other than adding the footer in each fragment and the view that I want below the tabs.
Is there a way to put headers(above) and footer(below) tabs using the actionbar?
PD. I am using Sherlock actionbar
Something inbetween the Actionbar and the Actionbar tabs? AFAIK it's not possible. ABS is only used in pre HC versions. On ICS+ the default ActionBar gets used. Therefore even if you can customize the ABS Actionbar you most likely can't override the default Actionbar on ICS+.