How to avoid view overlapping in RelativeLayout
<p>I have the following layout structure:</p>

<pre><code>&lt;RelativeLayout&gt;
    &lt;ScrollView&gt;
        &lt;LinearLayout&gt;
            &lt;RelativeLayout&gt;
                &lt;LinearLayout android:id="@+id/ContentNo1"&gt; &lt;-- Align top
                &lt;/LinearLayout&gt;
                &lt;LinearLayout android:id="@+id/ContentNo2"&gt; &lt;-- Align bottom
                &lt;/LinearLayout&gt;
            &lt;/RelativeLayout&gt;
        &lt;/LinearLayout&gt;
    &lt;/ScrollView&gt;
    &lt;Button/&gt; &lt;-- Always bottom of the page
&lt;/RelativeLayout&gt;
</code></pre>

<p>My button is Bottom-Aligned in the FIRST RelativeLayout, and my ScrollView Top-Aligned in it...</p>

<p>I want to Top-Align ContentNo1 inside the second RelativeLayout, and Bottom-Align ContentNo2 inside it...</p>

<p>I've done this, but when ContentNo1 gets too big, it overlaps ContentNo2, I want it just to push ContentNo2 down... How to do that?</p>

<p>I've tried (as detailed in some topics around here), to use layout_below / layout_above, but when I use it, the Bottom-Alignment of the ContentNo2 is dismissed...</p>

<p><strong>-- EDIT --</strong></p>

<p>As Wasi asked, here are the pictures: (I can't post more than 2 links, then I've made this page to explain it)</p>

<p><a href="http://www.mydonorlife.hol.es/relativeissue/" rel="nofollow noreferrer">http://www.mydonorlife.hol.es/relativeissue/</a></p>

<p><strong>-- EDIT 2 -- SOLUTION --</strong></p>

<p>This worked for me: I've removed the second RelativeLayout and set some weight/height tricks on some views as following >></p>

<pre><code>&lt;RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"&gt;
    &lt;ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_alignParentTop="true"
        android:fillViewport="true"&gt;
        &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"&gt;
                                                   &lt;!-- CONTENT NO 1 --&gt;
            &lt;LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_marginBottom="30dp"&gt;
            &lt;/LinearLayout&gt;
                                                   &lt;!-- /CONTENT NO 1 --&gt;
            &lt;LinearLayout
                android:layout_width="match_parent"
                android:orientation="vertical"
                android:layout_weight="1"
                android:layout_height="0dp"&gt;
                                                   &lt;!-- CONTENT NO 2 --&gt;
                &lt;LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:gravity="bottom"
                    android:layout_height="match_parent"
                    android:layout_weight="0"&gt;
                &lt;/LinearLayout&gt;
                                                   &lt;!-- /CONTENT NO 2 --&gt;
            &lt;/LinearLayout&gt;
        &lt;/LinearLayout&gt;
    &lt;/ScrollView&gt;
    &lt;Button
        android:layout_alignParentBottom="true"/&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>Hope it helps someone later...</p>