1

for some reason, the scrollview is getting pushed off of the screen

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_new_male_female_sf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >

<RelativeLayout
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="2" >

    <RelativeLayout
        android:id="@+id/rel_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

     //DYNAMICALLY PUTTING IMAGEVIEW HERE   

    </RelativeLayout>

    <Button
        android:id="@+id/next_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

<ScrollView
    android:id="@+id/scrollview"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="3" >

    <LinearLayout
        android:id="@+id/selection_bar"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

    </LinearLayout>

</ScrollView>

</LinearLayout>

i've tried making the outermost layout a relative layout, but then the scrollview overlaps with the nested relative layout. can anyone offer a suggestion?

ash
  • 11
  • 4

1 Answers1

0

It doesn't work because you are using match_parent as the height so the RelativeLayout take all the space. The weight is used to distribute the remaining empty space or take away space when the total sum is larger than the LinearLayout.

Set your widths to 0dp instead and it will work. :)

AlonsoFloo
  • 505
  • 3
  • 10
  • I tried that, it doesn't work. I just ended up deleting the button and things managed to fit. But thanks for the response, much appreciated! – ash Sep 13 '14 at 17:18