Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use a simple vertical LinearLayout (or a RelativeLayout) that contains your static header and footer, and use a ListView between them. You can set header and footer views on the ListView to add the scrollable header and footer content. For simplicity of example here's the LinearLayout way:</p> <pre><code> &lt;LinearLayout android:orientation="vertical" android:layout_height="match_parent" android:layout_width="match_parent"&gt; &lt;!--static header content... can be any kind of view--&gt; &lt;TextView android:layout_width="match_parent" android:layout_weight="0" android:layout_height="wrap_content"/&gt; &lt;ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/&gt; &lt;!--static footer content... can be any kind of view--&gt; &lt;TextView android:layout_width="match_parent" android:layout_weight="0" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>And in code, you can say:</p> <pre><code>ListView theList = (ListView)findViewById(R.id.list); // example of creating header and footer views from inflation or by instantiation in code View myHeaderView = getLayoutInflater().inflate(R.layout.myHeaderLayout,theList,false); View myFooterView = new TextView(this, some layout params); theList.addHeaderView(myHeaderView); theList.addFooterView(myFooterView); </code></pre> <p><a href="http://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View%29" rel="nofollow">ListView.addHeaderView</a> and ListView.addFooterView should enable you to add other static views (whose content could be updated dynamically) to the top or bottom of a ListView:</p> <blockquote> <pre><code>public void addHeaderView (View v) </code></pre> <p>Since: API Level 1 Add a fixed view to appear at the top of the list. If addHeaderView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want.</p> <p>NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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