D
D
dangerclose2014-06-02 11:39:27
Android
dangerclose, 2014-06-02 11:39:27

How to fill tabs with support library?

how to add elements to tabs

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        ab = getSupportActionBar();
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        
        Tab tab = ab.newTab();
        tab.setText("Screen 1");
        tab.setTabListener(this);
        ab.addTab(tab, 0, true);
        
        tab = ab.newTab();
        tab.setText("Screen 2");
        tab.setTabListener(this);
        ab.addTab(tab, 1, false);
        
        tab = ab.newTab();
        tab.setText("Screen 3");
        tab.setTabListener(this);
        ab.addTab(tab, 2, false);
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
one pavel, 2014-06-02
@onepavel

The Tab class object has a setCustomView method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question