tags:

views:

79

answers:

2

Hi Friends,

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

A: 

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
@Teja Kantamneni: Do not do this. `GridView` already knows how to scroll.
CommonsWare
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
+3  A: 

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