0

I am not sure whether maybe the tab navigation bar is not what I should be using. What I need is not so much tabbing, but opening of new activities when the user selects a section. If I can accomplish that with the tab navigation, how could I do that?

Here is what I have so far from other examples:

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    actionBar.setDisplayShowTitleEnabled(true);

    Tab tab = actionBar.newTab()
                .setText("Home")
                .setTabListener(?); 
    actionBar.addTab(tab);

    tab = actionBar.newTab()
                .setText("Learn")
                .setTabListener(?);
    actionBar.addTab(tab);        

    tab = actionBar.newTab()
            .setText("Services")
            .setTabListener(?);
    actionBar.addTab(tab);                

    tab = actionBar.newTab()
            .setText("Next Steps")
            .setTabListener(?);
actionBar.addTab(tab);    

Or should I use a list navigation instead?

Thank you Alex

4

1 回答 1

1

You could achieve it just fine with simply opening a new Activity, where you would normally inflate the new Fragment.

It is how ever not very normal to do so, and beats the idea of tabs.

In my opinion you really should use a list navigation, or even preferably the latest - and recently official - navigation drawer as you can see in Google Music and Google Earth.

于 2013-06-04T15:36:40.923 回答