How can i show exactly 2 lines in a GridView and scroll to show the other items? Thanks in advance.
Asked
Active
Viewed 1,127 times
3
-
AFAIK, there is no way to do this, other than to dynamically size your `GridView` to be exactly two rows tall. – CommonsWare Jun 14 '12 at 11:57
2 Answers
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
-
Thanks for the answer but what i want is 2 row and not too columns. – Vervatovskis Jun 14 '12 at 11:47
-
-
@Vervatovskis please see this link would be help ful http://stackoverflow.com/questions/11045743/android-add-n-number-of-views-in-scroll-view/11049433#11049433 – Dheeresh Singh Jun 15 '12 at 12:51