I need to size the imageView inside my table row programatically
<p>I've tried to set my <code>ImageView</code> resized but it did not work either by bitmap or other methods I'm going to place my code so if can anyone help me how to size the <code>ImageView</code> to fit inside the table row thnx.</p>

<pre><code>public class Test extends Activity
{
    private TableLayout Table1;
    protected void onCreate(Bundle savedInstanceState) 
    { 
        int[] ImageArray={R.raw.hospital_image,R.raw.hotel_image};
        super.onCreate(savedInstanceState);
        setContentView(R.layout.favorites);
        Table1 = (TableLayout) findViewById(R.id.Table);
        TableRow.LayoutParams tableRowParams = new TableRow.LayoutParams(
                TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT, 1.0f);
        for(int i=0;i&lt;ImageArray.length;i++)
        {
            TableRow TR = new TableRow(this);
            TR.setLayoutParams(tableRowParams);
            ImageView img=new ImageView(this);
            //What should i do here to resize it ???
            Drawable d = getResources().getDrawable(ImageArray[i]);
            img.setImageDrawable(d); 

            TR.addView(img, new TableRow.LayoutParams(
                    TableRow.LayoutParams.WRAP_CONTENT,
                    TableRow.LayoutParams.WRAP_CONTENT, 1.0f));

            Table1.addView(TR);
        }
    }
</code></pre>

<p>My XMl only holds these :</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" &gt;

    &lt;ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" &gt;

        &lt;TableLayout
            android:id="@+id/Table1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" &gt;
        &lt;/TableLayout&gt;
    &lt;/ScrollView&gt;

&lt;/RelativeLayout&gt;
</code></pre>
