TabActivity 该类已经过期
要使用tab可以直接继承Activity,不过要做相应的修改。
TabHost tabHost = getTabHost();改为
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
添加
LocalActivityManager lam = new LocalActivityManager(MainActivity.this, false); lam.dispatchCreate(savedInstanceState); mHost.setup(lam);
@Override protected void onPause() { lam.dispatchPause(isFinishing()); super.onPause(); } @Override protected void onResume() { lam.dispatchResume(); super.onResume(); }
http://stackoverflow.com/questions/3163884/android-tabhost-without-tabactivity