TabHost用法(2)

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final TabHost tabHost = getTabHost();

        tabHost.addTab(tabHost.newTabSpec("tab1")
                .setIndicator("xx")
                .setContent(new Intent(this, xx.class)));

        tabHost.addTab(tabHost.newTabSpec("tab2")
                .setIndicator("xx")
                .setContent(new Intent(this, xx.class)));
        
        // This tab sets the intent flag so that it is recreated each time
        // the tab is clicked.
        tabHost.addTab(tabHost.newTabSpec("tab3")
                .setIndicator("xx")
                .setContent(new Intent(this, xx.class)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
    }


你可能感兴趣的:(TabHost用法(2))