탭(TabHost, TabWidget)

[code java]




[/code]
[code java]
public class TabTest extends TabActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_test);

TabHost mTab = getTabHost();
Intent intent;

intent = new Intent().setClass(this, Tab01.class);
mTab.addTab(mTab.newTabSpec(“tag1”).setIndicator(“TAB1”).setContent(intent));

intent = new Intent().setClass(this, Tab02.class);
mTab.addTab(mTab.newTabSpec(“tag2”).setIndicator(“TAB2”).setContent(intent));

intent = new Intent().setClass(this, Tab03.class);
mTab.addTab(mTab.newTabSpec(“tag3”).setIndicator(“TAB3”).setContent(intent));

mTab.setCurrentTab(0);
}
}
[/code]

답글 남기기