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.

4

1 回答 1

0

将此添加到您的列表视图的父级,它可能是一个linear layoutrelative layout

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

如果已经有填充值,请将它们更改为那个值。

于 2015-04-19T17:47:09.853 回答