0

I have a problem with grid view layout on Android. I can't find solution to eliminate extra space in grid view.I mention the code fro gridview as below :-

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:alwaysDrawnWithCache="true"
android:background="@android:color/background_dark"
android:clipChildren="true"
android:columnWidth="100dp"
android:gravity="center_horizontal"
android:horizontalSpacing="2dp"
android:numColumns="auto_fit"
android:padding="0dp"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" />

now my application's grid view look like this enter image description here

As shown there is extra space which i want to remove it and it can look like this:-

enter image description here

So please provide me solution.. Thanks in advance..

Community
  • 1
  • 1
void
  • 479
  • 2
  • 13
  • 27

2 Answers2

0

You need to alter the value for android:columnWidth attribute for all layout types [hdpi,mdpi,xhdpi etc.] supported by your application.

βhargavḯ
  • 9,786
  • 1
  • 37
  • 59
0

You can use :

android:listSelector="@null"

to eliminate extera space and try this , for 3 column cell:

android:numColumn = "3"

Adnan Abdollah Zaki
  • 4,328
  • 6
  • 52
  • 58