底部的相对布局隐藏了中间的布局,以获得底部的等效高度。我的XML如下:
<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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
android:layout_above="@+id/footer"
在 body 布局中,而 body 在framelayout 中,为什么不使用relativelayout 来代替并修复你想要的高度。
android:layout_above="@+id/footer"
in body layoutand body is in framelayout, why dont you use relativelayout instead and fix the height how much you want.