Note that there are some explanatory texts on larger screens.

plurals
  1. POGridView and excess space padding
    primarykey
    data
    text
    <p>I have a problem with grid view layout on Android. I can't find solution to eliminate extra space in grid view. I tried a lot of things (numColumns, columnWidth, stretchMode, gravity) and advices (from StackOverflow), but nothing works correctly. I spent almost 8 hours with this problem. Here is a code of grid view:</p> <pre><code>&lt;GridView android:id="@+id/lookbook_gridview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:listSelector="@null" android:padding="0dip" android:layout_margin="0dip" android:verticalSpacing="0px" android:horizontalSpacing="0px" android:numColumns="auto_fit" android:columnWidth="160px" android:stretchMode="columnWidth" android:gravity="center" android:layout_gravity="center" android:background="#000" android:cacheColorHint="#000" android:descendantFocusability="afterDescendants" android:layout_alignParentTop="true" android:layout_above="@id/buttons"&gt; &lt;/GridView&gt; </code></pre> <p>I also tried to reduce extra space programically:</p> <pre><code>private void setGridview() { GridView gridview = (GridView) findViewById(R.id.lookbook_gridview); Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); int gridSize = display.getWidth(); int count = gridSize / 160; // image has 160x160 px int colWidth = (gridSize / count) - PADDING; gridview.setColumnWidth(colWidth); gridview.setNumColumns(count); } </code></pre> <p>But it works only on my HTC Desire (right), but on emulator (left) with the same display resolution and the same API version - it is not working.</p> <p><img src="https://i.stack.imgur.com/B3Xth.jpg" alt="enter image description here"></p> <p>Does somebody know, how to set images in gridview without any special padding or space to work successfully with all resolutions and devices?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload