RelativeLayout does not shrink in height

Posted by rudas on Stack Overflow See other posts from Stack Overflow or by rudas
Published on 2010-05-11T15:31:42Z Indexed on 2010/05/11 20:14 UTC
Read the original article Hit count: 259

Filed under:
|

Hi,

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.

I have tried most combinations of fill_parent, wrap_content etc without success.

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...

Please help /Rudas

<RelativeLayout android:id="@+id/RelativeLayout01" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content">

<ScrollView android:id="@+id/ScrollView01" android:layout_above="@+id/dialogCloseButton" android:layout_alignParentTop="true" android:layout_width="wrap_content" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/dialogContent" android:orientation="vertical" android:paddingBottom="10dp">
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content">
</TextView>
</LinearLayout>
</ScrollView>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Close" android:id="@+id/dialogCloseButton" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"></Button>
</RelativeLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about relativelayout