The Correct Answer
All the other answers are wrong. The important points:
- You don’t need
RelativeLayout. You can do this with just aLinearLayout. - (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).
- The critical thing is you need
android:baselineAligned="false". I actually only found this by looking through theLinearLayoutsource. It is in the docs but they don’t mention that it is on by default!
Anyway, here is the code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false">
<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"/>
<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"/>
<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"/>
</LinearLayout>
And how it looks:
