在一个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); 错误信息如下
解决方案 »
- android:如何做到点击链接,自己的程序可以响应?
- Android的openGL编程中的事件监听问题。
- 关于学习Android!进来指点
- 紧急求助,在线等答案!如何实现类似于超级玛丽中的,主人公在行走,但相对屏幕位置不变。。
- 安卓/linux中怎样调用原有的JNI so库函数
- WebView真机无法显示gif图片的问题
- 怎么把123456转成123,456这种形式
- 创建新的Android项目,Eclipse自动创建的appcompat内容
- 如何创建指定分辨率的浏览视图
- 视频播放 有声音没图像 Runnable 中添加的 SurfaceView 绑定MediaPlayer
- 如何重新设置bimpat的大小?
- 手机支付功能编写的困惑,急求各位大神帮助!!!!
我也深受其益