Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, as far as I got your needs I think you may just use the <code>ListView.addFooterView(View v)</code> method:</p> <p><a href="http://developer.android.com/reference/android/widget/ListView.html#addFooterView%28android.view.View%29" rel="nofollow noreferrer">http://developer.android.com/reference/android/widget/ListView.html#addFooterView(android.view.View)</a></p> <p>It will allow you to have all your list items + "a few buttons" footer to be scrolled as a single block.</p> <p>So the code should be smth like that:</p> <pre><code>import android.os.Bundle; import android.view.LayoutInflater; import android.widget.ArrayAdapter; import android.widget.LinearLayout; public class YourActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater factory = getLayoutInflater(); LinearLayout footer = (LinearLayout) factory.inflate(R.layout.your_a_few_buttons_footer, null); getListView().addFooterView(footer); String[] array = new String[50]; for (int i = 0; i &lt; 50;) { array[i] = "LoremIpsum " + (++i); } setListAdapter( new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, array) ); } } </code></pre> <p>Note, the doc says <code>addFooterView()</code> should be called BEFORE the <code>setListAdapter()</code>.</p> <p><strong>UPDATE</strong>: to add a <code>View</code> at the top of the list use <code>ListView.addHeaderView(View v)</code>. Note that, for instance, <code>LinearLayout</code> is also a <code>View</code>. So you can put anything you want as a header or a footer and it'll be scrolled with the list as an indivisible block.</p>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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