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
本文转自老Zhan博客园博客,原文链接:http://www.cnblogs.com/mybkn/archive/2012/05/18/2507623.html,如需转载请自行联系原作者