Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to programmatically change the height of a list element after the list has been populated
    primarykey
    data
    text
    <p>I'm working on a list of news items. My list is an <code>Activity</code> that extends <code>ListActivity</code>. I've also created an <code>ArrayAdapter</code> that I use to inflate the elements of my list. The <code>ArrayAdapter</code> uses a simple layout with an <code>ImageView</code> and two <code>TextView</code>s. Everything works but when I override the <code>onListItemClick()</code> method of the and try to resize the list elements when I click on them nothing happens.</p> <pre><code>protected void onListItemClick(ListView l, View v, int position, long id) { v.getLayoutParams().height=300; } </code></pre> <p>I've tried the above with <code>LayoutParams</code> as well</p> <p>Here is the layout of each row that I use to populate my list:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="100dp" android:background="@color/white" &gt; &lt;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" &gt; &lt;/ImageView&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;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" &gt; &lt;/TextView&gt; &lt;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" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Has anyone faced the same issue? Can anyone cast some light for a beginner in Android?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload