0

I have a View like below

enter image description here

<ScrollView android:id="@+id/appsgridscroll"
                android:layout_width="match_parent" 
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:fadeScrollbars="true"
                android:scrollbarFadeDuration="10000"
                android:layout_below="@id/applisttitlebar">
                <LinearLayout android:id="@+id/appsgridlayout"
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </LinearLayout>
        </ScrollView>

And I am dynamically adding GridViews to the Linearlayout.

I am running with below issue.

  1. The GridView does not stretch to fill its content (As you see the image show only first row when it have more items in GridView)

  2. The GridView does not scroll (it show the scroll bars - see image) on Phone (Android 4.1.2) but scroll on Nexus7 (7inch tablet)

Any ideas?? Please suggest.

Community
  • 1
  • 1
Vinayak Bevinakatti
  • 40,205
  • 25
  • 108
  • 139
  • Do not set the height of the gridview to wrap_content (if you are). Set the layout_weight instead. – Tarun Jun 26 '13 at 12:00

1 Answers1

0

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

Community
  • 1
  • 1
Tarun
  • 13,727
  • 8
  • 42
  • 57