Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd footer to layout with two fragments
    primarykey
    data
    text
    <p>I'm using two layouts with fragments, one for portait mode and one for landscape. I need to add a sticky footer to both layouts, and I've successfully added it to the portrait layout, but when I use similar code for the landscape layout it's not working. If I set the <code>layout_width</code> of the fragments to <code>0dp</code>, I see neither fragment, if I set the <code>layout_width</code> to <code>wrap_content</code> or <code>fill_parent</code>, the fragments overlaps each other.</p> <p>This is what I have so far:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" &gt; &lt;!-- Footer --&gt; &lt;TextView android:id="@+id/footer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /&gt; &lt;!-- Footer --&gt; &lt;fragment android:name="com.app.listing1" android:id="@+id/fragment1" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_above="@id/footer" /&gt; &lt;fragment android:name="com.app.listing2" android:id="@+id/fragment2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_above="@id/footer" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>EDIT</p> <p>I've gotten a little closer to what I want. If I put a set width on fragment1, then I get what I'm looking for, but that is, obviously, not ideal. For some reason, setting layout_width="wrap_content" on the layout of both fragments, as well as the layouts within each fragment, results in the first fragment taking over the entire screen:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" &gt; &lt;!-- Footer --&gt; &lt;TextView android:id="@+id/footer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /&gt; &lt;!-- Footer --&gt; &lt;fragment android:name="com.app.listing1" android:id="@+id/fragment1" android:layout_width="200dp" android:layout_height="fill_parent" android:layout_above="@id/footer" android:layout_toLeftOf="@id/fragment2" /&gt; &lt;fragment android:name="com.app.listing2" android:id="@+id/fragment2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_above="@id/footer" android:layout_toRightOf="@id/fragment1" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    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.
    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