public class TabTextActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_text);
TabHost tabhost;
tabhost=(TabHost)findViewById(R.id.tabhost_1);
tabhost.setup();
//标签1
TabSpec tabSpec=tabhost.newTabSpec("tab_1");
tabSpec.setContent(R.id.tab1);
tabSpec.setIndicator("在线音乐",this.getResources().getDrawable(R.drawable.list_view_icon_1));
tabhost.addTab(tabSpec);
//标签2
tabSpec=tabhost.newTabSpec("tab_1");
tabSpec.setContent(R.id.tab1);
tabSpec.setIndicator("在线电影",this.getResources().getDrawable(R.drawable.list_view_icon_2));
tabhost.addTab(tabSpec);
//标签3
tabSpec=tabhost.newTabSpec("tab_3");
tabSpec.setContent(R.id.tab3);
tabSpec.setIndicator("在线语音",this.getResources().getDrawable(R.drawable.list_view_icon_3));
tabhost.addTab(tabSpec);
}
}