title: GridView don't set the margins in ToggleButton programmatically
body: <p>I'm trying to set programmatically a ToggleButton inside of a Gridview. All seems that is working, but I can't set some properties like the margins between the togglebuttons that I'm adding in a loop for and this property:             toogleBtn.setAllCaps(false); don't work. </p>
  
  <p>Thanks in advance</p>
  
  <p>This is my xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      style="@style/screen"
      android:id="@+id/ly_general"
      android:fitsSystemWindows="true"
      android:background="@color/colorPrimary"&gt;
  
      &lt;TextView
          android:text="@string/your_interest"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textColor="@color/white"
          android:textSize="@dimen/text_size_22"
          android:id="@+id/text_init_session"
          android:layout_marginTop="@dimen/margin_26"
          android:layout_marginLeft="@dimen/padding_20"
          android:layout_below="@+id/image"/&gt;
  
      &lt;TextView
          android:text="@string/select_categories"
          android:textColor="@color/white"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/text_init_session"
          android:layout_alignLeft="@+id/text_init_session"
          android:layout_alignStart="@+id/text_init_session"
          android:layout_marginTop="22dp"
          android:id="@+id/textViewExplanation" /&gt;
  &lt;ScrollView
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fillViewport="true"
          style="@style/screen"
          android:id="@+id/scroll"
          android:layout_below="@+id/textViewExplanation"&gt;
  
          &lt;GridLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/lyCategory"
              android:layout_gravity="center_horizontal"
              android:orientation="horizontal"
              android:columnCount="3"
              android:layout_marginTop="@dimen/padding_40"&gt;
         &lt;/GridLayout&gt;
  &lt;/ScrollView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is my code in java class:</p>
  
  <pre><code>for (int i = 0; i &lt; arrayList.size(); i++) {
              final ToggleButton toogleBtn = new ToggleButton (RegisterThreeActivityNew.this);
              LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                      LinearLayout.LayoutParams.WRAP_CONTENT, GridLayout.LayoutParams.WRAP_CONTENT);
              params.setMargins(20, 20, 20, 20);
  
          toogleBtn.setLayoutParams(params);
          toogleBtn.setWidth(140);
          toogleBtn.setHeight(20);
          toogleBtn.setTextSize(12);
          toogleBtn.setAllCaps(false);
          toogleBtn.setText(arrayList.get(i).getName());
          toogleBtn.setTextOff(arrayList.get(i).getName());
          toogleBtn.setTextOn(arrayList.get(i).getName());
          toogleBtn.setTextColor(ResourcesCompat.getColor(getResources(), R.color.white, null));
          toogleBtn.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.btn_category, null));
  
  
          layoutCategories.addView(toogleBtn);
      }
  </code></pre>