Reputation: 89
I am using Android 3.0. I want to display a listview containing fragments. Each fragment consists of an image, a description, and some other UI elements.
I'm looking for some sample code or pointers.
Upvotes: 3
Views: 4113
Reputation: 2524
Your Fragment should extend ListFragment
. The ListFragment reference doc explains how to use custom ListView
and row layouts.
http://developer.android.com/reference/android/app/ListFragment.html
In the row layout (each row represents one list item), you can add an ImageView for displaying an image.
<ImageView android:id="@+id/imgView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/text2"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Upvotes: 2