Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try this:</p> <pre><code>public void bindView(final View v, final Context ctx, final Cursor c) { LinearLayout parent = (LinearLayout) v; final int position = c.getPosition(); Log.i("MyAdapter", "Cursor position: "+ position + "\tImages: "+ (parent.getChildCount() -1)); ((TextView) v.findViewById(R.id.content)) .setText(c.getString(c.getColumnIndex(COLUMN_A))); //use a linear layout defined in the item.xml instead of dynamically create one LinearLayout ll = (LinearLayout)v.findViewById(R.id.linearlayout); for (int i=0; i&lt;(position+1); i++) { SystemClock.sleep(i * 100); ImageView img = new ImageView(ctx); img.setImageResource(R.drawable.ic_launcher); //assign an id to the image to add int id = i+10000; img.setId(id); //check if the image has been already added. if(ll.findViewById(id) == null){ ll.addView(img); } } </code></pre> <p>}</p> <p><strong>item.xml:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/content" android:layout_width="match_parent" android:layout_height="30dip" android:text="---"/&gt; &lt;LinearLayout android:id="@+id/linearlayout" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>EDIT:</p> <p>you can of course skip the creation of the image and the sleep on next scrolling if you slightly change the for loop like this:</p> <pre><code> for (int i=0; i&lt;(position+1); i++) { int id = i+10000; //check if the image has been already added. if(ll.findViewById(id) == null){ SystemClock.sleep(i * 100); ImageView img = new ImageView(ctx); img.setImageResource(R.drawable.ic_launcher); //assign an id to the image to add img.setId(id); ll.addView(img); } } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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