Getting Android SDK WebView and TabWidget to play

2019-06-09 00:34发布

问题:

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?

回答1:

AFAIK, tabs will not work at the bottom.

TabHost and WebView work fine together, though I do not have a current sample that demonstrates this.