Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid custom dialog with scrollview pushes buttons off the screen
    text
    copied!<p>I have a custom dialog with a layout like this:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/mylayout"&gt; &lt;LinearLayout android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;TextView ... /&gt; &lt;TextView .../&gt; &lt;/LinearLayout&gt; &lt;ScrollView android:id="@+id/scrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/title"&gt; &lt;LinearLayout ...&gt; &lt;TextView ... android:text="lots of text........" /&gt; &lt;TextView .../&gt; &lt;/LinearLayout&gt; &lt;/ScrollView &lt;RelativeLayout ... android:layout_below="@+id/scrollView"&gt; &lt;Button ...&gt; &lt;Button ...&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>My problem is that the scrollview is that when there is too much text in the scrollview, the buttons below are pushed down out of the dialog. I've been able to prevent it by anchoring the RelativeLayout that contains the buttons to the bottom using android:layout_alignParentBottom="true", but I that stretches the entire dialog to the bottom of the screen when there is less text in the scrollview and I don't want that. </p> <p>How can I get a layout like this:</p> <pre><code>[SOME TEXT] [Scrollable region] [Buttons] </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