Note that there are some explanatory texts on larger screens.

plurals
  1. POlistview with header and footer
    text
    copied!<p>I am trying to build an Android View, with a listview as a header and footer. so far only managed that only appears to the header. Here is a picture that explains what I want and that I've got.</p> <p><img src="https://i.stack.imgur.com/6VScY.png" alt="Attempt"></p> <p>Does anyone know what I'm doing wrong? Dry the current code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#ffffff"&gt; &lt;!-- Header Starts--&gt; &lt;LinearLayout android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@layout/header_gradient" android:layout_margin="5dip" android:paddingTop="13dip" android:paddingBottom="8dip"&gt; &lt;!-- Logo Start--&gt; &lt;ImageView android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dip" /&gt; &lt;!-- Logo Ends --&gt; &lt;/LinearLayout&gt; &lt;!-- Header Ends --&gt; &lt;!-- Content --&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center"&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="5dip"&gt; &lt;EditText android:id="@+id/searchText" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"/&gt; &lt;ImageButton android:id="@+id/searchButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@android:drawable/ic_menu_search" /&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@+id/lstNews" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" /&gt; &lt;/LinearLayout&gt; &lt;!-- Footer Start --&gt; &lt;LinearLayout android:id="@+id/footer" android:layout_width="fill_parent" android:layout_height="30dip" android:background="@layout/footer_gradient" android:layout_margin="5dip" android:paddingTop="5dip" android:paddingLeft="5dip" android:layout_alignParentBottom="true"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:text="Instituto Superior de " /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:textStyle="bold" android:text="Engenharia" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:text=" do Porto" /&gt; &lt;/LinearLayout&gt; &lt;!-- Footer Ends --&gt;&lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload