WebView inside Tab hiding the tabWidgets

Posted by brockoli on Stack Overflow See other posts from Stack Overflow or by brockoli
Published on 2010-04-26T23:45:22Z Indexed on 2010/04/27 14:13 UTC
Read the original article Hit count: 436

Filed under:
|
|

I'm having trouble with a WebView always filling the full screen and thus covering my tabs. Here is my code for the tabhost..

    public class tabNZBMobile extends TabActivity {
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

  Resources res = getResources(); // Resource object to get Drawables
  TabHost tabHost = getTabHost();  // The activity TabHost
  TabHost.TabSpec spec;  // Reusable 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, NewzbinMobile.class);

  // Initialize a TabSpec for each tab and add it to the TabHost
  spec = tabHost.newTabSpec("search").setIndicator("Search",
    res.getDrawable(R.drawable.ic_tab_search))
    .setContent(intent);
  tabHost.addTab(spec);

  // Do the same for the other tabs
  intent = new Intent().setClass(this, sabnzbWeb.class);
  spec = tabHost.newTabSpec("sabnzbweb").setIndicator("SabNZBd",
    res.getDrawable(R.drawable.ic_tab_sabnzbweb))
    .setContent(intent);
  tabHost.addTab(spec);

  tabHost.setCurrentTabByTag("search");
 }}

My first tab (NewzbinMobile.class) displays correctly, it's just a relativelayout. But my second tab is an activity showing a webview and it is showing, but using the whole screen, covering my tabs. Here is the code for my second tab.

    public class sabnzbWeb extends Activity {
 WebView mWebView;
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  String sabNZBurl = new String("http://test.server.org:8080/m");

  mWebView = new WebView(this);
  mWebView.getSettings().setJavaScriptEnabled(true);
  setContentView(mWebView);
  mWebView.loadUrl(sabNZBurl);
 }}

© Stack Overflow or respective owner

Related posts about android

Related posts about webview