Matthieu
Matthieu

Reputation: 16397

ScrollView not scrolling after adding content dynamically

Here is my layout :

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
    <ScrollView
            android:id="@+id/button_scroll"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:fillViewport="true">
        <LinearLayout
                android:id="@+id/buttons"
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"/>
    </ScrollView>
</LinearLayout>

In my code, I am adding buttons into the horizontal LinearLayout id/buttons. Everything goes well except that after I add enough of them, it never scrolls.

I tried :

Upvotes: 0

Views: 1681

Answers (1)

Kenny
Kenny

Reputation: 5542

Try using HorizontalScrollView! ScrollView layout only scrolls vertically, as i found out a few weeks ago trying the same thing!

Upvotes: 2

Related Questions