3

主要活动:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    Resources ressources = getResources(); 
    TabHost tabHost = getTabHost(); 

    Intent intentHome = new Intent().setClass(this, Home.class);
    TabSpec tabHome = tabHost
      .newTabSpec("Android")
      .setIndicator("", ressources.getDrawable(R.drawable.home_icon))
      .setContent(intentHome);

    tabHost.addTab(tabHome);
    }

主页活动:

public class Home extends Activity {

private WebView browser;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home);

    this.browser = (WebView) findViewById(R.id.browser);
    this.browser.setWebViewClient(new WebViewClient());
    this.browser.loadUrl("http://google.com");
}
}

当我更改我的 Home.activity 和 WebView 重新加载选项卡时,我该如何关闭它?感谢帮助 :)

4

0 回答 0