Android web design to use

I want to create what seems to be a simple layout, but I have a few problems with it. The layout consists of a header, a body representing a web view, and a footer at the bottom, as shown in the attached sketch.

enter image description here

I need the webview to take up all the remaining space between the header and footer.

I tried this:

<?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>

+3
source share
2 answers

Put all of them in RelativeLayout and in webview use layout_below = "@ id / header_banner" and layout_above = "@ + id / footer_banner"

+2
source

This will work for you:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/ddd"
    android:orientation="vertical" >
     <ImageView  
     android:id="@+id/banner1"
     android:layout_height="wrap_content"
     android:layout_width="fill_parent" 
     android:src="@drawable/atm" /> 
    <WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" 
    />
    <ImageView  
     android:id="@+id/banner2"
     android:layout_height="wrap_content"
     android:layout_width="fill_parent"
     android:layout_weight="0" 
     android:src="@drawable/atm" /> 
</LinearLayout>
+1
source

All Articles