Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Table Row Image dimension
    text
    copied!<p>I want to put one image on the beginning of each row in my application . The problem is, the image is too big and when I put it there, it occupies the whole screen. </p> <p>main.xml : </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical" &gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/tableView" android:layout_height="fill_parent" android:layout_weight=".90" android:stretchColumns="1" &gt;&lt;/TableLayout&gt; &lt;/ScrollView&gt; </code></pre> <p>This is how I add the image : </p> <pre><code> TableLayout tableView = (TableLayout) findViewById(R.id.tableView); TableRow row = new TableRow(this); ImageView im; im = new ImageView(this); im.setImageResource(R.drawable.rss); row.addView(im); tableView.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); </code></pre> <p>I add the rows dynamically so, I want to add the image the same way.</p> <p>PS: There is no change if I replace</p> <pre><code>TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); </code></pre> <p>with</p> <pre><code>TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); </code></pre> <p>I would like to make the image much smaller. Could you help me out? </p>
 

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