1

I am having trouble with having a scroll with the LinearLayout with weights. It's supposed to have a weightSum of 3, then scroll after that. Here is my XML:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fillViewport="true" >

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="3"
    android:orientation="vertical"  >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

</LinearLayout>
</ScrollView>

After the third text view, I want it to scroll, which is why I set the weightSum to three. It currently does not scroll at all.

  • Sounds like you want the ScrollView nested inside the LinearLayout, not the other way around? – stkent Feb 08 '15 at 02:48
  • Well, weightSum is not like what you think! The scrollview will scroll only when its contents exceed the view. http://stackoverflow.com/questions/7452741/what-is-androidweightsum-in-android-and-how-does-it-work – T D Nguyen Feb 08 '15 at 02:56

0 Answers0