Note that there are some explanatory texts on larger screens.

plurals
  1. POLinearLayout layout_weight
    primarykey
    data
    text
    <p>I have a ListView that is populated with rows. These rows come from an XML file that looks like:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="8dip" android:weightSum="100"&gt; &lt;TextView android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/columnA" android:layout_weight="30" android:layout_gravity="center"/&gt; &lt;TextView android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/columnB" android:layout_weight="30" android:layout_gravity="center"/&gt; &lt;ImageView android:layout_width="0dp" android:layout_height="wrap_content" android:src="@drawable/icon" android:id="@+id/columnC" android:layout_weight="10" android:layout_gravity="center" &gt; &lt;/ImageView&gt; &lt;CheckBox android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/columnD" android:layout_weight="30" android:layout_gravity="center"/&gt; </code></pre> <p></p> <p>The problem is that I want the columnC item and columnB item to be very close together, so that my rows are equally spaced out in three parts, i.e.: columnA, (columnB+columnC) and then columnD. I tried to achieve this by using layout_weight as you can see, however the above code seems to have the opposite effect. columnA and columnB are very squished on the left, column C seems to be floating in a large space on its own, and then columnD is located close to columnC, with too much space on its right. What am I doing wrong? :s</p>
    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.
 

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