3

How can i show exactly 2 lines in a GridView and scroll to show the other items? Thanks in advance.

Vervatovskis
  • 2,277
  • 5
  • 29
  • 46

2 Answers2

1

You can give it a fixed height

<GridView
        android:id="@+id/gridView1"
        android:layout_width="fill_parent"
        android:layout_height="250dp"
        android:layout_marginLeft="25dp"
        android:layout_marginRight="25dp"
        android:layout_toRightOf="@+id/previous"
        android:columnWidth="150dp"
        android:horizontalSpacing="5dip"
        android:numColumns="2"
        android:stretchMode="columnWidth"
        android:verticalSpacing="30dp" />
Anu
  • 552
  • 3
  • 9
0

if here 2 lines are for 2 Columns then see this

http://developer.android.com/reference/android/widget/GridView.html#setNumColumns(int)

or in XML inside grid tag

android:numColumns="2"

Dheeresh Singh
  • 15,643
  • 3
  • 38
  • 36