試試這個代碼
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