Adding a vertical scrollbar to an AlertDialog in Android?

In order for a view to scrollable, it must be nested inside of a ScrollView container:

<ScrollView>
    <LinearLayout android:orientation="vertical"
            android:scrollbars="vertical"
            android:scrollbarAlwaysDrawVerticalTrack="true">
        <TextView />
        <Button />
    </LinearLayout>
</ScrollView>

Note that a ScrollView container can only have one child layout view. It is not possible, for example, to place a TextView and Button in a ScrollView without the LinearLayout.

Leave a Comment