0

I want to add scroll bar in gridview,How can i add scroll bar in grid view?

sivaraj
  • 1,849
  • 9
  • 35
  • 52

2 Answers2

4

I want to add scroll bar in gridview,How can i add scroll bar in grid view?

GridView already has a scrollbar, so there is nothing that you need to do. In Android 2.2, the bar will only appear by default when the user is actively swiping the grid. There are a series of attributes defined on the View class you can use to tailor the behavior of the scrollbar.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
-1

Wrap your grid view in a scrollview.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/scrollview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#ffffff"
            android:paddingTop="10dip"
            android:paddingLeft="5dip"
            android:layout_weight="1"
        >
</ScrollView>
Teja Kantamneni
  • 17,402
  • 12
  • 56
  • 86
  • 2
    A GridView is basically a ListView with columns. All of the same concepts apply. Putting a ListView or GridView into a ScrollView is like trying to parse HTML with regex. Your only reward for the attempt will be pain and misery. – adamp Sep 08 '10 at 23:06