Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get rid of spaces in gridview
    primarykey
    data
    text
    <p>This thing has been doing my head in for a little while now and I can't seem to be able to solve it.</p> <p>I've got a grid view, in which I display a few bitmaps. I add a padding of 5dp on all image sides when filling up my image view via the adapter (iv.setPadding(5, 5, 5, 5);), but somehow, there's more space being added to the top and bottom on each item on my gridview.</p> <p>I know this has already been <a href="https://stackoverflow.com/questions/5291265/delete-border-space-around-gridview">asked</a> a <a href="https://stackoverflow.com/questions/4036990/why-are-there-extra-pixels-around-my-android-gridview">few</a> <a href="https://stackoverflow.com/questions/6876861/removing-the-extra-padding-in-a-gridview-in-android">times here</a>, and some of them even have accepted answers, however, when I try to sue the answers as described on the URL's above, I still keep getting the same extra spaces on top and bottom.</p> <p>Is there any other way of doing this nowadays?</p> <p>Here's some of my code:</p> <p><strong>Main.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/imageGrid" android:layout_width="fill_parent" android:layout_height="wrap_content" android:numColumns="6" /&gt; </code></pre> <p><strong>grid_item.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid_item_image" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; </code></pre> <p>I have tried adding the following to my listselector attribute in main.xml</p> <ul> <li>@null</li> <li>@drawable/solid_white</li> <li>@android:id/empty</li> </ul> <p>Here's how it looks like with the extra spaces on top and bottom (the ones on the sides are the ones I'm adding as described above):</p> <p><img src="https://i.stack.imgur.com/qvQHk.png" alt="enter image description here"> </p> <p>Any other ideas as to how to get those bloody spaces removed so my grid view has the same spacing?</p> <p>Thanks in advance,</p>
    singulars
    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.
 

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