Mark M. | has entered the room |
Mark M. | turned on guest access |
Tawanna | has entered the room |
Tawanna |
Hi Mark, how are you?
|
Mark M. |
howdy, Tawanna!
|
Mark M. |
how can I help you today?
|
Tawanna |
View paste
|
Feb 2 | 10:00 AM |
Mark M. |
when you say "header" and "footer", should they be
scrolling with the list contents, or are they supposed to stay fixed on
the screen?
|
Tawanna |
They are static
|
Mark M. |
then the chapter and tutorials you are reading are not what you want
|
Mark M. |
certainly, not mine
|
Mark M. |
those are for what *Android* refers to as headers and footers, which scroll with the list contents
|
Mark M. |
for static headers and footers, put them outside of the ListView
|
Mark M. |
for example, have a LinearLayout that holds the header, the ListView, and the footer
|
Mark M. |
use android:layout_weight properly to have the ListView fill all space not needed by the header and footer
|
Tawanna |
ok. this may be a silly question but what links the listview to the actual row layout?
|
Mark M. |
the adapter
|
Tawanna |
right now, i don't have an actual list view layout defined
|
Mark M. |
well, if you are using ListActivity or ListFragment, you do not ordinarily need a layout for the overall activity or fragment
|
Mark M. |
in your case, though, you do, as you want to have more than just a ListView
|
Mark M. |
so, you create a layout and call setContentView() for the ListActivity, or implement onCreateView() in ListFragment
|
Mark M. |
in that layout, you need a ListView whose ID is @android:id/list
|
Tawanna |
okay, that was something i didn't quite understand. the adapter will know based on that id
|
Mark M. |
not really
|
Feb 2 | 10:05 AM |
Mark M. |
let's simplify matters: are you using ListFragment, ListActivity, or something else?
|
Tawanna |
ListActivity
|
Mark M. |
OK
|
Mark M. |
ListActivity is an activity
|
Mark M. |
activities have a content view
|
Tawanna |
right
|
Mark M. |
that content view is normally set via setContentView()
|
Mark M. |
ListActivity will call setContentView() for you if needed, for a full-screen ListView
|
Mark M. |
in your case, you will call setContentView() yourself
|
Mark M. |
you **also** need to call setListAdapter()
|
Mark M. |
this will tell the ListActivity (who tells the ListView) what ListAdapter is to be used for the rows
|
Mark M. |
the ListAdapter you supply to setListAdapter() determines what the rows look like
|
Tawanna |
okay! now i see the connection!
|
Tawanna |
thank you!
|
Mark M. |
you may wish to read the "Getting Fancy with
Lists" chapter from _The Busy Coder's Guide to Android Development_, and
perhaps the preceding chapter ("Using Selection Widgets"), for more on
this subject
|
Tawanna |
Awesome! Thank you!
|
Feb 2 | 10:10 AM |
Mark M. |
do you have another question?
|
Tawanna |
no, that's all for now
|
Mark M. |
OK, if you think of anything, chime in
|
Tawanna |
will do
|
Feb 2 | 10:55 AM |
Mark M. |
just about the end of the chat -- any final questions?
|
Tawanna |
no, thanks for your help!
|
Feb 2 | 11:00 AM |
Tawanna |
enjoy the rest of your day!
|
Mark M. |
you too!
|
Mark M. |
next chat is Wednesday, 7:30pm Eastern
|
Tawanna |
ok!
|
Tawanna | has left the room |
Mark M. | turned off guest access |