Note that there are some explanatory texts on larger screens.

plurals
  1. PORelativeLayout does not shrink in height
    primarykey
    data
    text
    <p>I cannot get my relative layuot view to shrink when using it in the follwing layout, used as a dialog. In below example the scrollview always expands to fill the entire dialog which looks very ugly if there is not much actual content.</p> <p>I have tried most combinations of fill_parent, wrap_content etc without success.</p> <p>The problem seems to be that setting the button to "align_bottom" will cause the dialog to fill its height. But if I change the order and have to button placed below the scrollview the button will not be visible if a lot of content is shown...</p> <p>Workaround (that I think is a very ugly solution) is to set a margin-bottom on the scrollview and then the same negative margin-top on the button. But I'm not sure how this will look at different displays. </p> <p>Please help /Rudas</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ScrollView android:id="@+id/ScrollView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/dialogCloseButton" android:layout_alignParentTop="true" &gt; &lt;LinearLayout android:id="@+id/dialogContent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="10dp" &gt; &lt;TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; &lt;Button android:id="@+id/dialogCloseButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Close" &gt; &lt;/Button&gt; &lt;/RelativeLayout&gt;&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ScrollView android:id="@+id/ScrollView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/dialogCloseButton" android:layout_alignParentTop="true" &gt; &lt;LinearLayout android:id="@+id/dialogContent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="10dp" &gt; &lt;TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; &lt;Button android:id="@+id/dialogCloseButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Close" &gt; &lt;/Button&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.
 

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