Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h1>The Correct Answer</h1> <p>All the other answers are wrong. The important points:</p> <ol> <li>You don't need <code>RelativeLayout</code>. You can do this with just a <code>LinearLayout</code>.</li> <li>(Not critical but I guess you didn't know) Your weights don't need to sum to 1, you can just set them all to any equal value (e.g. 1).</li> <li>The critical thing is you need <strong><code>android:baselineAligned="false"</code></strong>. I actually only found this by looking through the <code>LinearLayout</code> source. It is in the docs but they don't mention that it is <em>on by default!</em></li> </ol> <p>Anyway, here is the code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:baselineAligned="false"&gt; &lt;TextView android:text="dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg dfg" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#eeffee" android:layout_gravity="bottom"/&gt; &lt;TextView android:text="asd asd asd asd asd asd asd asd asd asd" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#eeeeff" android:layout_gravity="bottom"/&gt; &lt;TextView android:text="qweoiu qweoiuqwe oiqwe qwoeiu qweoiu qweoiuq weoiuqw eoiquw eoiqwue oqiweu qowieu qowieu qoiweu qowieu qowieu qowieu qowieu qoiweu qowieu qoiwue " android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffeeee" android:layout_gravity="bottom"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>And how it looks:</p> <p><img src="https://i.stack.imgur.com/zw3p0.png" alt="Good linear layout"></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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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