I have a listactivity which will display a list of persons name and address with data from arraylist of objects. here's the method to fill the listview so far..
private void fillData(ArrayList<Person> messages) {
//populating list should go here
}
The person class is stores name and address of a person.
public class Person {
String name;
String address;
}
While my listitem for my listview consist of two textview, like this :
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:mode="twoLine"
android:clickable="false"
android:paddingBottom="9dp"
android:paddingTop="5dp" >
<TextView
android:id="@+id/display_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/display_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/display_name"
android:layout_below="@+id/display_name"
android:textAppearance="?android:attr/textAppearanceSmall" />
I want each item in my listview to displaying both the name and address of each person. Can somebody please help ?
Thanks in advance, and sorry for my bad English...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…