1

我有以下视图树:

  • 相对布局
    • 滚动视图
      • 相对布局
        • 网络视图
        • LinearLayout (rightOf webview)

加载网页后,我需要 LinearLayout 与 WebView 具有相同的高度。我怎样才能做到这一点?

我正在使用的布局 xml

<ScrollView android:id="@+id/scroll_view" android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:fadingEdge="none" >

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

        <RelativeLayout android:id="@+id/view_touchbutton" android:layout_width="50dp" android:layout_alignParentRight="true"
                      android:layout_height="fill_parent" android:background="@drawable/next_page_white" android:layout_alignParentTop="true"
                      android:gravity="center_horizontal">
            <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content"
                       android:layout_marginTop="300dp"
                       android:src="@drawable/sipka_dalsi"
                       android:contentDescription="sipka"/>
        </RelativeLayout>

        <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content"
                   android:id="@+id/imageview_content" android:contentDescription="image"
                   android:src="@drawable/bezobrazku_clanek" android:scaleType="fitXY"/>

        <LinearLayout android:id="@+id/layout_info_box" android:layout_width="fill_parent" android:layout_height="fill_parent"
                      android:layout_alignBottom="@id/imageview_content" android:background="#aa000000"
                android:orientation="vertical" android:gravity="left|center_vertical" android:visibility="gone">

        </LinearLayout>

        <ImageButton android:id="@+id/button_info_box_switch" android:layout_alignLeft="@id/imageview_content" android:layout_alignBottom="@id/imageview_content"
                android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:src="@drawable/info" android:background="@null"/>


        <View android:id="@+id/view_red_divider" android:layout_width="fill_parent" android:layout_height="4dp" android:background="#990505" android:layout_below="@id/imageview_content"/>

        <WebView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_toLeftOf="@id/view_touchbutton"
                 android:id="@+id/webview" android:layout_below="@id/view_red_divider" android:fitsSystemWindows="true"/>

    </RelativeLayout>
</ScrollView>

<LinearLayout android:id="@+id/layout_splash_screen" android:layout_width="fill_parent" android:layout_height="fill_parent"
              android:gravity="center_horizontal|center_vertical" android:background="#ecece7" android:visibility="gone" >

    <ProgressBar style="?android:attr/progressBarStyleInverse" android:layout_width="wrap_content" android:layout_height="wrap_content"
                 android:indeterminate="true" android:paddingRight="8dp" />
</LinearLayout>

4

1 回答 1

1

更改您的RelativeLayout身份 LinearLayout并将WebViewLinearLayout的权重设置为 android:layout_weight="1"

于 2012-09-05T13:47:27.743 回答