kudo44
kudo44

Reputation: 13

How to scroll a LinearLayout horizontally?

I have a LinearLayout that I do larger than the screen. I want to scroll that in horizontal. I have the next code but it doesn't work. Can anybody help me?

<HorizontalScrollView
    android:id="@+id/horizontalScrollView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <LinearLayout
        android:id="@+id/gm_movimientos"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:orientation="horizontal" >

    </LinearLayout>
</HorizontalScrollView>

Upvotes: 1

Views: 4332

Answers (1)

Vyrx
Vyrx

Reputation: 763

Your HorizontalScrollView width needs to be set to either match_parent or a fixed size. Right now the ScrollView is expanding to the same dimensions of the LinearLayout (i.e. its bounds are also going off of the screen).

Upvotes: 3

Related Questions