I'm working on a list of news items. My list is an Activity
that extends ListActivity
. I've also created an ArrayAdapter
that I use to inflate the elements of my list. The ArrayAdapter
uses a simple layout with an ImageView
and two TextView
s. Everything works but when I override the onListItemClick()
method of the and try to resize the list elements when I click on them nothing happens.
protected void onListItemClick(ListView l, View v, int position, long id) {
v.getLayoutParams().height=300;
}
I've tried the above with LayoutParams
as well
Here is the layout of each row that I use to populate my list:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="@color/white"
>
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="10dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_launcher" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="10dp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="10dp" >
</TextView>
</LinearLayout>
</LinearLayout>
Has anyone faced the same issue? Can anyone cast some light for a beginner in Android?