5

Is it possible?

I can use fragments, and I can put the tabs on the bottom, but I can't with ActionBar Sherlock. Does anybody have any idea how to do it?

I'm using something like this to use the tabs (they're on the bottom):

tHost = (TabHost) findViewById(R.id.tabhost2);

    tHost.setup();

    tM = new TabManager(this, tHost, android.R.id.tabcontent);

    tM.addTab(tHost.newTabSpec("tabCREATE").setIndicator("Criar"),
            Criar.CountingFragment.class, null);

    tM.addTab(tHost.newTabSpec("tabCREATE2").setIndicator("Criar2"),
            Criar.CountingFragment.class, null);

How can I change it to the ActionBar tab?

I normally use this for the actionbar:

getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    for (int i = 1; i <= 3; i++) {
        ActionBar.Tab tab = getSupportActionBar().newTab();
        if (i == 1) {
            tab.setText("a");
        }
        else if(i == 2)
            tab.setText("b");
        else if (i == 3)
            tab.setText("c");
        tab.setTabListener(this);
        getSupportActionBar().addTab(tab);

And it's fine, but I really need to put it on the bottom. Is it possible to set the Tabhost on that second method? And how? I believe that it would solve all my problems.

Victor Santiago
  • 902
  • 1
  • 10
  • 20
  • I think this is what you are looking for: http://stackoverflow.com/a/8468675/33203 – ashokgelal Jan 03 '13 at 06:12
  • No. What I want to do is put the ActionBarSherlock's Tabs on the bottom. – Victor Santiago Jan 04 '13 at 03:57
  • You can't do this with the action bar. If you really really feel the need to go against the operating system's design guidelines, you can recreate the look and feel of an action bar using `LinearLayout`s and `android:layout_weight` – edthethird May 03 '13 at 22:10

2 Answers2

0

In your manifest add this code android:uiOptions="splitActionBarWhenNarrow"

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          android:uiOptions="splitActionBarWhenNarrow"
          android:versionCode="431"
          android:versionName="4.3.1"
          package="com.actionbarsherlock.sample.demos">

and in your activity add this code again

<activity android:label="@string/activity_name" 
          android:uiOptions="splitActionBarWhenNarrow"
          android:name=".SampleList" android:theme="@style/Theme.Sherlock">

I tried in on samples and it works on it

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Girish Nair
  • 5,148
  • 5
  • 40
  • 61
0

I think you can't do it with ActionBar. android:uiOptions="splitActionBarWhenNarrow" just adds extra space for ActionBar to the bottom of the screen but it will be only for MenuItems and not for tabs. ActionBar design guidelines always has tabs at top. Take a look at http://www.androiduipatterns.com/2011/07/tabs-top-or-bottom.html where is a nice discussion where tabs should be located.

Kuitsi
  • 1,675
  • 2
  • 28
  • 48