I want a ListView which displays name and info about each item using simple_list_item_2
, so it looks something like this:
SWITZERLAND
a country with many delicious cheeses
BRITAIN
famous for its clocktower
AUSTRALIA
in Australia, everything is upside down!
The text in caps is meant to represent the large black text in each ListView element and the lower caps text represents the grey, small type of that element.
However, I want the user to be able to add his own countries, so the first element would show up as
ADD NEW COUNTRY...
Without any small-type text. I can use simple_list_item_2
and simply set the small text to ""
, but this aligns the large text awkwardly. I want this special "add new country" element to look exactly like simple_list_item_1
.
However, the decision to use simple_list_item_1
or simple_list_item_2
is made in the initialization of my adapter:
MyAdapter adapter = new MyAdapter(
this,
android.R.layout.simple_list_item_2,
myListOfListViewElements);
And then this decision is realized when I populate the ListView:
myListView.setAdapter(adapter);
So how can I use both kinds of simple_list_item in one ListView?