底部的相对布局隐藏了中间的布局,以获得底部的等效高度。我的XML如下:

发布于 2024-12-04 11:15:12 字数 2687 浏览 2 评论 0原文

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

    <RelativeLayout android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:background="@drawable/activity_header_background">

        <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:textSize="17dip"
        android:textStyle="bold"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:text="@string/help_faq_menu">
        </TextView>
    </RelativeLayout>

    <FrameLayout android:id="@+id/body"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/faq_header">

        <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

        <ProgressBar
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        style="?android:attr/progressBarStyle"
        android:layout_gravity="center_horizontal|center_vertical"
        android:visibility="gone">
        </ProgressBar>
    </FrameLayout>

    <RelativeLayout android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:background="@drawable/activity_footer_background"
    android:layout_alignParentBottom="true">

        <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:background="@drawable/button_drawable_shape"
        android:text="@string/done">
        </Button>

        <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_centerVertical="true"
        android:background="@drawable/button_drawable_shape"
        android:text="@string/contact_support">
        </Button>

        <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/refresh"
        android:layout_marginRight="5dip"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:background="@null">
        </ImageButton>  
    </RelativeLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

    <RelativeLayout android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:background="@drawable/activity_header_background">

        <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:textSize="17dip"
        android:textStyle="bold"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:text="@string/help_faq_menu">
        </TextView>
    </RelativeLayout>

    <FrameLayout android:id="@+id/body"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/faq_header">

        <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

        <ProgressBar
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        style="?android:attr/progressBarStyle"
        android:layout_gravity="center_horizontal|center_vertical"
        android:visibility="gone">
        </ProgressBar>
    </FrameLayout>

    <RelativeLayout android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:background="@drawable/activity_footer_background"
    android:layout_alignParentBottom="true">

        <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:background="@drawable/button_drawable_shape"
        android:text="@string/done">
        </Button>

        <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_centerVertical="true"
        android:background="@drawable/button_drawable_shape"
        android:text="@string/contact_support">
        </Button>

        <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/refresh"
        android:layout_marginRight="5dip"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:background="@null">
        </ImageButton>  
    </RelativeLayout>
</RelativeLayout>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人间☆小暴躁 2024-12-11 11:15:12
android:layout_below="@+id/body" give in footer Relativelayout

android:layout_above="@+id/footer" 在 body 布局中

,而 body 在framelayout 中,为什么不使用relativelayout 来代替并修复你想要的高度。

android:layout_below="@+id/body" give in footer Relativelayout

android:layout_above="@+id/footer" in body layout

and body is in framelayout, why dont you use relativelayout instead and fix the height how much you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文