My activity extends ListActivity. This is how I set the list to the Adapter:
this.setListAdapter(new ArrayAdapter<String>(
this, R.layout.imgTxtView,
R.id.items,retrievedTasks));
RetrivedTasks is a String of tasks/items stored in shared pref.
I have this List in a Linear Layout
<ListView
android:id="@android:id/list"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<!--android:id="@android:id/list"-->
</ListView>
And this is another Linear Layout (imgTxtView) that serves as a row in the List
<ImageView
android:id="@+id/icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@drawable/star" />
<TextView
android:id="@+id/items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:paddingTop="5dp"/>
The idea is when you click on just the image the image will change and the background for the TextView items.
All solutions talk about a Custom Adapter.
Now, is there a way to accomplish this WITHOUT using one?
Aucun commentaire:
Enregistrer un commentaire