试试这个代码
public class WebMenu extends TabActivity {
//Intent intent;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tebmenu);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent = new Intent().setClass(this, Add_webpage.class);
spec = tabHost
.newTabSpec("Add new Web Page")
.setIndicator("New",
res.getDrawable(R.drawable.folder_web_blue))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, WebHistory.class);
spec = tabHost.newTabSpec("Web History")
.setIndicator("History", res.getDrawable(R.drawable.webhistory))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, WebList.class);
spec = tabHost.newTabSpec("Web List")
.setIndicator("List", res.getDrawable(R.drawable.weblist))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(2);
}
}
很久以前想试试这个......我会试试看非常感谢你! – user754730 2012-03-23 10:24:53
不客气。这是一个很棒的工具来创建兼容的应用程序:) – Tim 2012-03-23 10:25:43
哇,它真的是...刚刚从Play商店安装了演示应用程序...真的是太棒了!再次感谢我现在认为我现在将使用ActionBarSherlock的应用程序! – user754730 2012-03-23 10:32:23