UI android question/problem with Listview
<p>I'm trying to recreate the UI screen called 'My Places' that is used in the Weather Channel app.  I'd attach a screenshot of the screen, but I can't seem to do it here.  It seems they're using two listviews one on top of the other, but I'm not sure for certain. Could anybody confirm this for me? If they are doing this, how is this done? I've tried to implement this, but without full success. My top listview 'Add a place' 'comes up correctly, but the bottom listview will not appear/populate for me? I shall attach my code so far......</p>

<p>Any help would be greatly appreciated.</p>

<p>header_row.xml</p>

<pre><code>&lt;?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="wrap_content"&gt;
ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="6dip"
android:src="@drawable/ic_menu_add" /&gt;
LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent"&gt;
TextView
android:id="@+id/caption"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Add a place"/&gt;
/LinearLayout&gt;
/LinearLayout&gt;
</code></pre>

<p>main.xml</p>

<pre><code>?xml version="1.0" encoding="utf-8"?&gt;
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip"&gt;
ListView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&gt;
LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"&gt;
ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/&gt;
/LinearLayout&gt;
/LinearLayout&gt;

public class ListViewTest extends Activity
{
private static String[] items={"lorem", "ipsum", "dolor",
"sit", "amet", "consectetuer",
"adipiscing", "elit", "morbi",
"vel", "ligula", "vitae",
"arcu", "aliquet", "mollis",
"etiam", "vel", "erat",
"placerat", "ante",
"porttitor", "sodales",
"pellentesque", "augue",
"purus"};

private ListView Header;
private ListView List;
private ArrayList&lt;Caption&gt; caption = null;
private CaptionAdapter adapter;
private ArrayAdapter listAdapter;

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

caption = new ArrayList&lt;Caption&gt;();
Caption cap = new Caption();
cap.setCaption("Add a place");
caption.add(cap);

this.adapter = new CaptionAdapter(this, R.layout.header_row, caption);

Header = (ListView) findViewById(R.id.header);

Header.setAdapter(adapter);

//Log.d("ListViewTest", "caption size is:" + caption.size());

adapter.notifyDataSetChanged();

List = (ListView) findViewById(R.id.list);

listAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, items);

List.setAdapter(listAdapter);

listAdapter.notifyDataSetChanged();

//setListAdapter(new ArrayAdapter&lt;String&gt;(this,
//android.R.layout.simple_list_item_1,
//items));
}

private class CaptionAdapter extends ArrayAdapter&lt;Caption&gt;
{
private ArrayList&lt;Caption&gt; caption;

public CaptionAdapter(Context context, int textViewResourceId, ArrayList&lt;Caption&gt; caption)
{
super(context, textViewResourceId, caption);
this.caption = caption;
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;

if (v == null)
{
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.header_row, null);
}

Caption c = caption.get(position);

if (c != null)
{
TextView caption = (TextView) v.findViewById(R.id.caption);

if (caption != null)
{
caption.setText(c.getCaption());
}
}

return v;
}

}
}
</code></pre>
