Note that there are some explanatory texts on larger screens.

plurals
  1. POBeginner android developer - having difficulty with layouts
    text
    copied!<p>I have a button that's below a <code>ScrollView</code>, the button is set to align to the parents bottom. The scroll view is set to <code>wrap_content</code> for its height. Once the <code>ScrollView</code> is filled with content it appears beneath the button. How can I set it to not go behind the button, for the <code>ScrollView</code>to end when the button begins?</p> <p>I've tried placing <code>android:layout_below</code> in the bottom button, and when that didn't work I tried <code>layout_above</code> in the <code>ScrollView</code> for above the button. That last one caused my app to crash on start, no idea why. The first one once the <code>ScrollView</code> is longer than the screen it causes the button to be placed underneath with no way to access it.</p> <p>Here's my XML file.</p> <pre><code>&lt;RelativeLayout 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:background="@color/light_blue" android:padding="5dp" tools:context=".MainActivity" &gt; &lt;EditText android:id="@+id/editText_query" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/queryPromt" android:imeOptions="actionNext" android:inputType="text" android:textColor="#000" /&gt; &lt;EditText android:id="@+id/editText_tag" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/editText_query" android:layout_marginTop="10dp" android:layout_toLeftOf="@+id/saveButton" android:hint="@string/tagPrompt" android:imeOptions="actionDone" android:inputType="text" /&gt; &lt;Button android:id="@id/saveButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_below="@id/editText_query" android:text="@string/save" /&gt; &lt;TextView android:id="@+id/textView_taggedSearches" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignRight="@id/saveButton" android:layout_below="@id/saveButton" android:layout_marginTop="10dp" android:background="#666" android:gravity="center_horizontal" android:text="@string/taggedSearches" android:textColor="#FFF" android:textSize="18sp" /&gt; &lt;ScrollView android:id="@+id/scrollView_query" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/textView_taggedSearches" android:padding="5dp" &gt; &lt;TableLayout android:id="@+id/tableLayout_query" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:stretchColumns="*" &gt; &lt;/TableLayout&gt; &lt;/ScrollView&gt; &lt;Button android:id="@+id/button_clearTags" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="@string/clearTags" /&gt; &lt;/RelativeLayout&gt; </code></pre>
 

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