1

To create a navigation bar, I have dynamically create an action bar:

public void onCreate(Bundle savedInstanceState) {
    ActionBar actionBar = getActionBar();
}

And add tabs one by one:

    // Create first Tab
    tab = actionBar.newTab().setTabListener(new FragmentsTab1());
    // Create your own custom icon
    tab.setIcon(R.drawable.tab1_hdpi);
    actionBar.addTab(tab);

The problem is , the action bar is at the top by default. How can I placed it at the bottom? I found layout_below may be suitable for this case . However , as it generates dynamically, how can I know its ID? Thanks a lot.

Edited:

After adding split option, it doesn't make any changes, is it due to my action bar is dynamically generated?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:uiOptions="splitActionBarWhenNarrow"
package="com.example.tabtest"
android:versionCode="1"
android:versionName="1.0" >

And

       <activity
        android:name="com.example.tabtest.MainActivity"
        android:uiOptions="splitActionBarWhenNarrow"
        android:label="@string/app_name" >
user782104
  • 13,233
  • 55
  • 172
  • 312

3 Answers3

1

Add this to your activity tag in the Minifest

 uiOptions="splitActionBarWhenNarrow"
mmoghrabi
  • 1,233
  • 1
  • 14
  • 23
0

You haven't really answered the OP's question.. I'm searching for an answer as well since it looks like the custom bar always gets placed top and default menu bar on bottom if I use this code to bring the custom view:

            ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    // displaying custom ActionBar
    View mActionBarView = getLayoutInflater().inflate(R.layout.custom,
            null);
    actionBar.setCustomView(mActionBarView);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

:(

Danny Kim
  • 310
  • 1
  • 3
  • 10
0

With Android 5.0 API, uiOptions="splitActionBarWhenNarrow" is deprecated. Unfortunately, this is not very well documented as yet. For details, you can read up this article.

http://commonsware.com/blog/2014/11/18/android-5p0-deprecation-splitactionbarwhennarrow.html

samkya
  • 329
  • 1
  • 4