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