I am trying to create a ListView using the following code:
setListAdapter(new ArrayAdapter<String>(this, R.layout.settings_items, settingsLabels));
With settingsLabels being a string array and settings_items being a RelativeLayout, including both a TextView and an ImageView. Unfortunately, I cannot parse this as the resource. How do I properly implement this? The ImageView source is the same regardless of item. What is the easiest way to get around this ?
EDIT settings_item.xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/settings_item_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/image_leftarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:src="@android:drawable/ic_media_play" />
</RelativeLayout>
Change your code for creating the adapter like this: