Reputation: 10297
If it's possible, how can I add a "header" above the layout I've got assigned to my SimpleCursorAdapter ("ondemandandautomatic_authorize"), and a button below the ListView?
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
R.layout.ondemandandautomatic_authorize, mContacts,
new String[] { ContactsContract.Contacts.DISPLAY_NAME },
new int[] { R.id.contactLabel });
setListAdapter(mAdapter);
What I've got displaying now in my Activity is:
<AppName>
<ckbx1><ckbx2><ckbx3><TextView (ContactName)>
...(repeating the line above for each contact)
But what I want is:
<AppName>
<TextView1><TextView2><TextView3><TextView4>
<ckbx1> <ckbx2> <ckbx3> <TextView (ContactName)>
...(repeating the line above for each contact)
<Button>
Possible?
Upvotes: 0
Views: 71
Reputation: 1498
You probably want to add a Footer to the ListView if you want the Button at the bottom of list, here is the javadoc.
getListView().addFooterView(new Button(...));
This HAS to be done before setListAdapter(mAdapter);
.
Upvotes: 1
Reputation: 694
Use Listviewinstance.addHeaderView(viewtobeadded) for list header part and Listviewinstance.addFooterView(buttontobeadded) for the button at the bottom of the footer part.
Please make sure that these footer and header addition things must be done before setting adapter on your listview.
Upvotes: 1