android webview布局占用剩余空间 [英] android webview layout to take remaining space
本文介绍了android webview布局占用剩余空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个看起来很简单的布局,但是我遇到了一些问题. 布局由页眉,主体(即Web视图)和底部的页脚横幅组成,如随附的草图所示.
I want to create, what seems to be a simple layout, but I am having a few problems with it. The layout consists of a header, body which is a webview, and a footer banner on bottom as seen on the attached sketch.
我需要Web视图占用页眉和页脚之间的所有剩余空间.
我已经尝试过了:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/back"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/banner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/banner" />
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bck"
android:layout_weight="2"
android:layout_gravity="center"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4">
<com.mobclix.android.sdk.MobclixMMABannerXLAdView
android:id="@+id/banner_adview"
android:layout_width="320dip"
android:layout_height="50dip"
android:layout_gravity="center"
android:layout_alignParentBottom="true" />
</RelativeLayout>
推荐答案
将所有内容放入RelativeLayout内,并在网络视图中使用layout_below ="@ id/header_banner"和layout_above ="@ + id/footer_banner"
Put all of them inside a RelativeLayout and in the webview use layout_below="@id/header_banner" and layout_above="@+id/footer_banner"
这篇关于android webview布局占用剩余空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文