Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would try CommonsWare <a href="https://github.com/commonsguy/cwac-merge" rel="noreferrer">MergeAdapter</a> as pointed to by Rajesh. It sounds like exactly what you need.</p> <p>It will take multiple views (including listviews) and put them together, then you set the merge adapter to a listview and presto, you have several listviews in one.</p> <p>Quoting from the docs for it:</p> <p>MergeAdapter accepts a mix of Adapters and Views and presents them as one contiguous whole to whatever ListView it is poured into. This is good for cases where you have multiple data sources, or if you have a handful of ordinary Views to mix in with lists of data, or the like.</p> <p>Simply create a MergeAdapter and call addAdapter(), addView(), or addViews() (latter accepting a List), then attach your adapter to the ListView. </p> <p><strong>EDIT</strong></p> <p>1) Download the .jar from <a href="https://github.com/downloads/commonsguy/cwac-merge/CWAC-MergeAdapter.jar" rel="noreferrer">here</a><br> 2) Download the .jar for <a href="https://github.com/commonsguy/cwac-merge/blob/master/libs/CWAC-SackOfViewsAdapter.jar" rel="noreferrer">CWAC SackOfViewsAdapter</a> as the MergeAdapter requires it.<br> 2) Create a directory in your project called "libs" (on the same level as src &amp; res)<br> 3) place both of the .jar files in that folder (Eclipse should automatically take things from there as far as setting it up to be included in the build)<br> 4) Use the MergeAdapter per the instructions from the first link in my original response.</p> <p>Pseudo-code example:</p> <pre><code>myMergeAdapter = new MergeAdapter(); myMergeAdapter.addView(HeaderView); myMergeAdapter.addView(SmallHeaderView1); myMergeAdapter.addAdapter(listAdapter1); myMergeAdapter.addView(SmallHeaderView2); myMergeAdapter.addAdapter(listAdapter2); myMergeAdapter.addView(SmallHeaderView3); myMergeAdapter.addAdapter(listAdapter3); setListAdapter(myMergeAdapter); </code></pre> <p><strong>EDIT 2</strong></p> <p>Adding your header which is a complete layout:</p> <pre><code>View Header = getLayoutInflater.inflate(R.layout.red_cell); myMergeAdapter.addView(Header); </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