0

I have a grid view inside my layout and I am trying to make it stretch all the way across the screen. My XML for this gridview follows below.

 <GridView
    android:numColumns="auto_fit"
    android:gravity="center"
    android:stretchMode="columnWidth"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/gridView"
    android:layout_below="@+id/editText"
    android:columnWidth="400dp"
    android:clickable="true"
    android:background="#fffefff9"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

The grid view does not completely fill the screens width. There are these small margins on the side. How do I get rid of these margins on the sides of the grid view completely? In other word, I want the width of the grid view to be full width. On the other hand, fill_parent does make the grid view's width cover 95% of the width of the screen, but there are small margins on the side of the screen. Unfortunately, I am not allowed to post an image since I don't have enough reputation.

Rehaan Ahmad
  • 794
  • 8
  • 23
  • You may have a padding set on the parent of the `GridView` - without the other contents of the layout, it's nearly impossible to accurately answer your question. – MH. Apr 19 '15 at 17:25

1 Answers1

0

Add this to your list view's parent it might be a linear layout or relative layout

android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"

If there was already padding values change them to that.

JCodes13
  • 488
  • 5
  • 17