-1

Layout:

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >      


 <GridView
    android:id="@+id/galleryImage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:numColumns="6"
    android:scrollbars="horizontal" >
    </GridView>
</LinearLayout>

Code:

myGV= (GridView) findViewById(R.id.galleryImage);
listImage = new profileAdapter(this, R.layout.layoutimage);
myGV.setAdapter(listImage);

I have set number columns by value of listImage

myGV.setNumColumns(listImage.getCount());

Why are horizontal scrollbars of Gridview not working?

Andy Jones
  • 6,205
  • 4
  • 31
  • 47
mum
  • 1,637
  • 11
  • 34
  • 58

1 Answers1

0

Hello please use below xml code I have added HorizontalScrollView

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tool"
android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:fillViewport="true" >

     <GridView
        android:id="@+id/galleryImage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:numColumns="6">
      </GridView>

</HorizontalScrollView>
Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90
Kanaiya Katarmal
  • 5,974
  • 4
  • 30
  • 56