Search code examples
androidtextviewandroid-buttonandroid-scrollview

How to scroll content?


I have the following problem:

I need 18 Button with a TextView beside them and one TextView on the top among themselves. Of course, they don't fit on the display and so I searched this problem and find the ListView but this doesn't work for me because I need 18 Buttons and TextViews with different Ids.

I hope you can help me.


Solution

  • use <ScrollView> Note <ScrollView> has only one direct child

    so it must used like :

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >
            <!--  your contents  are here  -->
        </LinearLayout>
    
    </ScrollView>