4

画面の下部にタブウィジェットを配置し、その上に webview を配置しています。webview がロードする web ページのコンテンツが画面よりも大きい場合、webview は展開して tabwidget を変換します。

スクロールビューのサイズを利用可能な画面スペースに合わせたいと思います。私の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>

スクロールビューの高さを設定しましたが、予想どおり、特定のデバイスに対してのみ正確であり、普遍的ではありません。

任意の支援をいただければ幸いです。

4

1 に答える 1

0

この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>
于 2013-02-05T11:25:18.147 に答える