On the left column there will be a picture, while on the right column will be another table, with two rows, one for the name and one for the surname.
So, my layout xml is this:
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/widget45"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<ListView android:id="@+id/listv1" android:layout_width="fill_parent"
android:gravity="center_vertical" android:layout_height="wrap_content">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TableRow>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_gravity="center_horizontal">
</ImageView>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TableRow>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
</TableRow>
</TableLayout>
</ListView>
</LinearLayout>
The adapter is ready,
- Code: Select all
...
public View getView(int position, View convertView, ViewGroup parent) {
IconifiedTextView btv;
if (convertView == null) {
btv = new IconifiedTextView(mContext, mItems.get(position));
} else { // Reuse/Overwrite the View passed
// We are assuming(!) that it is castable!
btv = (IconifiedTextView) convertView;
btv.setText(mItems.get(position).getText());
btv.setIcon(mItems.get(position).getIcon());
btv.setSecText(" "+mItems.get(position).getSecText());
}
return btv;
}
...
but I do not know how to create the View to be displayed properly on the layout I designed (IconifiedTextView).

