停止Android webview覆盖tabwidget

停止Android webview覆盖tabwidget,android,android-layout,tabwidget,Android,Android Layout,Tabwidget,我在屏幕底部放置了一个tabwidget,上面有一个webview。当webview加载的网页内容大于屏幕时,webview将展开以转换tabwidget,因为布局高度设置为在webview及其所在的滚动视图中包裹内容 我想将滚动视图调整到可用屏幕空间的大小。 我的xml如下所示: <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.c

我在屏幕底部放置了一个tabwidget,上面有一个webview。当webview加载的网页内容大于屏幕时,webview将展开以转换tabwidget,因为布局高度设置为在webview及其所在的滚动视图中包裹内容

我想将滚动视图调整到可用屏幕空间的大小。 我的xml如下所示:

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="0dp" >

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="-4dp"
        android:gravity="top" />

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true" >

        <ScrollView
            android:id="@+id/scroll1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:scrollbars="none"
            tools:ignore="UselessParent" >

            <WebView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/webView1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:gravity="bottom"/>
        </ScrollView>

    </FrameLayout>
</RelativeLayout>

我已经为scrollview设置了一个设置的高度,但正如预期的那样,它只适用于特定的设备,而不是通用的


任何帮助都将不胜感激。

使用此xml,它将解决您的问题:

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="0dp" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <ScrollView
                android:id="@+id/scroll1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:scrollbars="none"
                tools:ignore="UselessParent" >

                <WebView
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/webView1"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:gravity="bottom" />
            </ScrollView>
        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>

</TabHost>


对于任何有相同问题的人-我过了一段时间后回到这里,通过简单地在scrollview中添加一个android:layout\u marginBottom值来解决它。您是否尝试过删除工具:ignore=“UselessParent”我最初忽略了这一行,它给了我一个类似的错误。