FileDocCategorySizeDatePackage
Tabs2.javaAPI DocAndroid 1.5 API2019Wed May 06 22:41:08 BST 2009com.example.android.apis.view

Tabs2

public class Tabs2 extends android.app.TabActivity implements TabHost.TabContentFactory
Example of using a tab content factory for the content via {@link TabHost.TabSpec#setContent(android.widget.TabHost.TabContentFactory)} It also demonstrates using an icon on one of the tabs via {@link TabHost.TabSpec#setIndicator(CharSequence, android.graphics.drawable.Drawable)}

Fields Summary
Constructors Summary
Methods Summary
public android.view.ViewcreateTabContent(java.lang.String tag)
{@inheritDoc}

        final TextView tv = new TextView(this);
        tv.setText("Content for tab with tag " + tag);
        return tv;
    
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);

        final TabHost tabHost = getTabHost();
        tabHost.addTab(tabHost.newTabSpec("tab1")
                .setIndicator("tab1", getResources().getDrawable(R.drawable.star_big_on))
                .setContent(this));
        tabHost.addTab(tabHost.newTabSpec("tab2")
                .setIndicator("tab2")
                .setContent(this));
        tabHost.addTab(tabHost.newTabSpec("tab3")
                .setIndicator("tab3")
                .setContent(this));