1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| private void initTabHost() {
//tabHost = new TabHost(getApplicationContext());
tabHost = (TabHost)findViewById(android.R.id.tabhost);
tabHost.setup();
Drawable d = ContextCompat.getDrawable(this, R.drawable.home);
String[] tabName = {"Tab1", "Tab2", "Tab3", "Tab4", "Tab5", "Tab6"};
for(int i =0; i<tabName.length; i++)
{
TabHost.TabSpec tabSpec;
tabSpec = tabHost.newTabSpec(tabName[i]);
tabSpec.setIndicator("", d);
tabSpec.setContent(new FakeContent(getApplicationContext()));
tabHost.addTab(tabSpec);
}
tabHost.setOnTabChangedListener(this);
} |
Partager