I have a RelativeLayout in a ScrollView on which I have set to fill_parent. However, it only fills horizontally, not vertically. There is more content I want to put in the RelativeLayout, but first I need to figure out why the RelativeLayout won't fill the height of the ScrollView.
Thanks for any assistance.
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/gray"
android:layout_below="@+id/previewButton"
android:layout_marginTop="10dp" >
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_below="@+id/matchingWordsLabel"
android:background="@color/white"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
>
<TextView
android:id="@+id/titleLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Title:"
/>
<EditText
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/titleLabel"
android:layout_alignBaseline="@+id/titleLabel"
android:ems="10" />
</RelativeLayout>
</ScrollView>
Add
android:fillViewPort="true"
to the ScrollView
.
fill_parent
or match_parent
height inside a ScrollView
doesn't really make sense and it is ignored - otherwise there would be no need for scrolling. fillViewPort="true"
makes the scroll view take up all vertical space available on screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With