Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Layout with middle component expand
    primarykey
    data
    text
    <p>I am trying to create the following layout.</p> <pre><code>+---------------------+ | Text View | +---------------------+ | | | | | Custom View | | Expands to | | extra space | | | +---------------------+ |Button1 |Button2 | +---------------------+ </code></pre> <p>My layout xml looks like the following.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:text="This is test text." android:id="@+id/statusTxt" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/gameView" android:layout_gravity="bottom"&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/gameButtonView"&gt; &lt;Button android:text="Done" android:id="@+id/doneBtn" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/Button&gt; &lt;Button android:text="Undo" android:id="@+id/undoBtn" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/Button&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Than programatically I am adding my custom view</p> <pre><code>LinearLayout gameView = (LinearLayout)this.findViewById(R.id.gameView); gameView.addView(gameBoardView, 1); </code></pre> <p>With the current layout it ends up looking like this.</p> <pre><code>+---------------------+ | Text View | +---------------------+ |Button1 |Button2 | +---------------------+ | | | | | Custom View | | Expands to | | extra space | | | +---------------------+ </code></pre> <p>What this current layout does is it sticks the bottom buttons above the Custom View. Any ideas on how I can get it to render how I have described?</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.
 

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