Getting Android SDK WebView and TabWidget to play nice

Posted by jdandrea on Stack Overflow See other posts from Stack Overflow or by jdandrea
Published on 2009-09-16T15:57:24Z Indexed on 2010/06/02 21:04 UTC
Read the original article Hit count: 567

I’m taking the HelloTabWidget Android example and trying two things:

  • Moving the tabs to the bottom vs. the top (if that’s even desirable from an Android UI POV)
  • Making each tab show a particular WebView in the space above

I’ve got this for a layout (high level):

<TabHost>
  <LinearLayout>
    <FrameLayout>
      <WebView/>
      <WebView/>
      <WebView/>
      <WebView/>
      <WebView/>
    </FrameLayout>
    <TabWidget/>
  </LinearLayout>
</TabHost>

Everything has a width/height set to fill_parent except for the TabWidget which has its layout_height set to wrap_content (and the layout_gravity set to bottom).

First thing I noticed is that WebViews don’t show anything until all the parents have width/height set to fill_parent. However, once I do that, they fill the entire display, obscuring the TabWidget.

Is there some other trick to making these two views play nicely together?

© Stack Overflow or respective owner

Related posts about android

Related posts about layout