title: Android margin between buttons in grid layout
body: <p>I'm trying to create a grid layout containing buttons but by default there is a space between these buttons and I don't need that. The .xml file looks like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_gravity="center"&gt;
      &lt;HorizontalScrollView android:id="@+id/HorizontalScrollView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"&gt;
      &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/gridLayout"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"&gt;
      &lt;/GridLayout&gt;
    &lt;/HorizontalScrollView&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>The code where I create the buttons and add it to the grid layout: </p>
  
  <pre><code>for (int rowCounter = 0; rowCounter &lt; DIMENSION; rowCounter++)
      for (int columnCounter = 0; columnCounter &lt; DIMENSION; columnCounter++) {
          Button b = new Button(this);
          b.setText(" ");
          GridLayout.LayoutParams params = new GridLayout.LayoutParams();
          params.setMargins(0, 0, 0, 0);
          b.setLayoutParams(params);
          gridLayout.addView(b);
      }
  </code></pre>
  
  <p>Here is an image of how it looks: </p>
  
  <p><a href="https://i.stack.imgur.com/Rp4G9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rp4G9.jpg" alt="image"></a>
  </p>