Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make my Android LinearLayout weights work with values of 1 and 2?
    primarykey
    data
    text
    <p>I'm trying to make a LinearLayout that has three rows, each of equal height. I am making this using 3 LinearLayouts inside the main one, each with a layout_weight of 1.</p> <p>The middle LinearLayout should contain an ImageView, TextView, ImageView, with weights of 1,2,1. To do this, inside the middle LinearLayout I created another 3.</p> <p>I want the TextView to be double the size of each ImageView. If you see the code below, when layout_weight is 1 for the inner LinearLayouts I have no problems, the three appear of equal size. However when I set the middle one (with id=textLayout) to layout_weight=2, it completely disappears (as seen in the Eclipse graphical layout viewer) and only the two others are visible.</p> <p>I have no idea why this is... any pointers?</p> <p>Thanks</p> <p> </p> <pre><code>&lt;LinearLayout android:id="@+id/LayoutTop" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/LayoutMid" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;ImageView android:layout_height="fill_parent" android:layout_width="fill_parent"&gt; &lt;/ImageView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/textLayout" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="2"&gt; &lt;TextView android:text="Status" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;ImageView android:layout_height="fill_parent" android:layout_width="fill_parent"&gt; &lt;/ImageView&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/LayoutBottom" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;/LinearLayout&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    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. 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