How to add images to ScrollView dynamically?
<p>I am trying to add images to scrollview dynamically. To add images to scrollview I am using this code:</p>

<pre><code>        LinearLayout sv = (LinearLayout)findViewById( R.id.filesScrollerLayout);
        ImageView iv = new ImageView(this);
        iv.setImageDrawable( new BitmapDrawable( pub.FirstPicture ) ); // same happens with ScaleDrawable.
        iv.setScaleType( ScaleType.CENTER_INSIDE );
        sv.addView( iv ); 


&lt;ScrollView
    android:id="@+id/scrollView2"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentTop="true"
    android:layout_toRightOf="@+id/scrollView1"
    android:background="#FFFF00" &gt;

    &lt;LinearLayout
        android:id="@+id/filesScrollerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" &gt;
    &lt;/LinearLayout&gt;
&lt;/ScrollView&gt;
</code></pre>

<p>So I need to add images to this scrollview like this:</p>

<pre><code>|-------------
|
|Image 1
|-------------
|
|Image 2
|-------------
|
|Image 3
|-------------
</code></pre>

<p>For this I need to change somehow content size of Scrollview ? </p>

<p>How this is done in Android ?</p>

<p>Thanks.</p>
