在一个Activity里面放一个抽屉,抽屉里面放个Tab,弄了好久没有成功
TabHost tabHost = (TabHost)findViewById(R.id.tabhost);
tabHost.setup( new ActivityGroup().getLocalActivityManager ()); if (tabHost==null)Log.i("JSY", "NULL");
else Log.i("JSY", "NOTNULL");
// tabHost= getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, MyChanceList.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec(res.getString(R.string.str_forecast)).setIndicator(res.getString(R.string.str_forecast),
res.getDrawable(R.drawable.icon))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, OtherChanceList.class);
spec = tabHost.newTabSpec(res.getString(R.string.str_history)).setIndicator(res.getString(R.string.str_history),
res.getDrawable(R.drawable.icon))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0); 错误信息如下
TabHost tabHost = (TabHost)findViewById(R.id.tabhost);
tabHost.setup( new ActivityGroup().getLocalActivityManager ()); if (tabHost==null)Log.i("JSY", "NULL");
else Log.i("JSY", "NOTNULL");
// tabHost= getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, MyChanceList.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec(res.getString(R.string.str_forecast)).setIndicator(res.getString(R.string.str_forecast),
res.getDrawable(R.drawable.icon))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, OtherChanceList.class);
spec = tabHost.newTabSpec(res.getString(R.string.str_history)).setIndicator(res.getString(R.string.str_history),
res.getDrawable(R.drawable.icon))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0); 错误信息如下
我也深受其益