Scroll view does not work

52 views Asked by At

I have a scroll view that I fill dynamicly in my code. I expect if I put too much content to the parant view that the view becomes scrollable. This does not work.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_centerHorizontal="true"
            android:id="@+id/layoutScoreBoardHeader"
            android:layout_marginTop="15dp">

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/layoutScoreBoard"
            android:orientation="horizontal"
            android:layout_centerHorizontal="true"
            android:layout_below="@id/layoutScoreBoardHeader">

        </LinearLayout>

    </RelativeLayout>
</ScrollView>
2

There are 2 answers

0
3mpty On

Bad layout structure. RelativeLayout should wrap_content. In your case it will be same size as initial ScrollView and it will ignore child size.

0
Jürgen Schmitt On

I have it. Did not know that there is a special view like horizontal scroll view. But thank you guys for your feedback!