Note that there are some explanatory texts on larger screens.

plurals
  1. PORelativeLayout: Can't assign a view above a referenced view if margin is involved
    primarykey
    data
    text
    <p>I was trying to put a TextView <code>dependent</code> above the other TextView <code>anchor</code> inside a RelativeLayout, but I can't manage to make the <code>dependent</code> get displayed. </p> <p><strong>Situation:</strong><br/> The <code>anchor</code> would be aligned with the parent's top + some <em>marginTop</em> to make it more to the center of the parent (RelativeLayout), and the <code>dependent</code> will be aligned to be above of this <code>anchor</code>. </p> <p>This doesn't work; when I assigned it to be above the <code>anchor</code> it seems that android assumes the top of the <code>anchor</code> is the parent's top and draws the <code>dependent</code> outside the screen (above it).</p> <p>This should not be the case since I use <em>margin</em> instead of <em>padding</em> so the area between the top of the RelativeLayout and the <code>anchor</code> shouldn't be the part of the <code>anchor</code> itself (I checked the size with hierarchy viewer). Or maybe I get it wrong? :S</p> <p>This is the simple layout code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/anchor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="100px" android:text="Anchor point." /&gt; &lt;TextView android:id="@+id/dependent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/anchor" android:text="Dependent." /&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>Desired:</strong><br/></p> <pre> ------------- | | |dependent | |anchor | | | ------------- </pre> <p><strong>What happened:</strong><br/></p> <pre> dependent (out of screen display) ------------- | | | | |anchor | | | ------------- </pre> <p><strong>Hope:</strong><br/> Could someone help me here? Or maybe help pointing out if I made a mistake. I need to use the RelativeLayout in my real implementation (above is just an example).</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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