1
我想創建一個由兩個選項卡每個進行操作自己的WebView的應用程序。我可以創建標籤,但無法管理他們的網頁瀏覽。要創建「兩個選項卡設有2個獨立的WebView」
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Drawables
TabHost 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, fbActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("fb").setIndicator("fb",
res.getDrawable(R.drawable.ic_tab_fb))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, google.class);
spec = tabHost.newTabSpec("google").setIndicator("google",
res.getDrawable(R.drawable.ic_tab_google))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
你會得到什麼作爲輸出輸入所有三類... – 2013-03-19 10:30:36
你的代碼是正確的。你得到什麼輸出 – 2013-03-19 10:32:54
我有標籤的輸出,但它沒有顯示我的網頁視圖... – Gaurav 2013-03-19 12:22:46