Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>See the more highly voted answer below. Mine is woefully outdated</strong></p> <hr> <p>i can address one issue <strong>Justin</strong> raised: inability of RelativeLayout to manage positioning of an include (at least in this simple case, on a 1.6 emulator)</p> <p><strong>CommonsWare</strong> suggests wrapping the includes in a unique parent container, but does so in order to assist addressing &amp; scoping identically named Views within <strong>Justin's</strong> includes</p> <blockquote> <p>Each would have to have a unique parent container, and you would call findViewById() on that container (ViewGroup) rather than on the Activity.</p> </blockquote> <p>In fact, you <em>also must do it</em> in order to get RelativeLayout to behave as expected:</p> <p>This works (<em>footer</em> is well positioned):</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;include android:id="@+id/header" layout="@layout/header" android:layout_alignParentTop="true" /&gt; &lt;WebView android:id="@+id/webView" android:layout_below="@id/header" android:background="#77CC0000" android:layout_height="wrap_content" android:layout_width="fill_parent" android:focusable="false" /&gt; &lt;LinearLayout android:layout_alignParentBottom="true" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt; &lt;include android:id="@+id/footer" layout="@layout/footer" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>This does not (<em>footer</em> is floating at top of screen):</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;include android:id="@+id/header" layout="@layout/header" android:layout_alignParentTop="true" /&gt; &lt;WebView android:id="@+id/webView" android:layout_below="@id/header" android:background="#77CC0000" android:layout_height="wrap_content" android:layout_width="fill_parent" android:focusable="false" /&gt; &lt;include android:id="@+id/footer" layout="@layout/footer" android:layout_alignParentBottom="true" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The bare <em>footer</em> include will not align to bottom of parent, without the surrounding LinearLayout.. I wouldn't call this expected behavior.</p> <p>Additionally, the WebView appears to attach itself nicely to the <em>header</em> by ID, but I believe this to be illusion, due to it simply flowing below the header vertically. I also tried to set a button right above the footer include, but it got all floaty and wrong, too</p> <p>RelativeLayout had more problems in 1.5, but i still like it :)</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. 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