Tabhost 运用详解
2012-09-03 15:08:53 来源:WEB开发网核心提示:myMenuRes[0]));secondTabSpec.setIndicator("Topics", getResources().getDrawable(myMenuRes[1]));threeTabSpec.setIndicator("Video", getResource
myMenuRes[0]));
secondTabSpec.setIndicator("Topics", getResources().getDrawable(
myMenuRes[1]));
threeTabSpec.setIndicator("Video", getResources().getDrawable(
myMenuRes[2]));
fourTabSpec.setIndicator("Podcast", getResources().getDrawable(
myMenuRes[3]));
fiveTabSpec.setIndicator("Gallery", getResources().getDrawable(
myMenuRes[4]));
six.setContent(new Intent(this,FirstTab.class));
firstTabSpec.setContent(new Intent(this, FirstTab.class));
secondTabSpec.setContent(new Intent(this, SecondTab.class));
threeTabSpec.setContent(new Intent(this, FirstTab.class));
fourTabSpec.setContent(new Intent(this, SecondTab.class));
fiveTabSpec.setContent(new Intent(this, SecondTab.class));
/* Add tabSpec to the TabHost to display. */
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(threeTabSpec);
tabHost.addTab(fourTabSpec);
tabHost.addTab(fiveTabSpec);
tabHost.addTab(six);
}
}
secondTabSpec.setIndicator("Topics", getResources().getDrawable(
myMenuRes[1]));
threeTabSpec.setIndicator("Video", getResources().getDrawable(
myMenuRes[2]));
fourTabSpec.setIndicator("Podcast", getResources().getDrawable(
myMenuRes[3]));
fiveTabSpec.setIndicator("Gallery", getResources().getDrawable(
myMenuRes[4]));
six.setContent(new Intent(this,FirstTab.class));
firstTabSpec.setContent(new Intent(this, FirstTab.class));
secondTabSpec.setContent(new Intent(this, SecondTab.class));
threeTabSpec.setContent(new Intent(this, FirstTab.class));
fourTabSpec.setContent(new Intent(this, SecondTab.class));
fiveTabSpec.setContent(new Intent(this, SecondTab.class));
/* Add tabSpec to the TabHost to display. */
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(threeTabSpec);
tabHost.addTab(fourTabSpec);
tabHost.addTab(fiveTabSpec);
tabHost.addTab(six);
}
}
更多精彩
赞助商链接