Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The key here is to use a <code>LinearLayout</code> setting a <code>layout_weight</code> value just for your canvas. This way, the top and above views will wrap their content, and the canvas will fill the free space. The layout xml would look like this.-</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:layout_width="match_parent" android:layout_height="50dp" android:gravity="center_vertical|center_horizontal" android:background="#990099" android:text="Some text here" /&gt; &lt;RelativeLayout android:id="@+id/canvas" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#999900" android:layout_weight="1"&gt; &lt;!-- The canvas --&gt; &lt;/RelativeLayout&gt; &lt;Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;RelativeLayout android:id="@+id/banner" android:layout_width="match_parent" android:layout_height="100dp" android:background="#009999"&gt; &lt;!-- The banner --&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Notice I set some hardcoded heights and colors so that you can easily see the results. This layout will render a view like this.-</p> <p><img src="https://i.stack.imgur.com/Yr8Ba.png" alt="enter image description here"></p>
 

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