title: how set "app:layout_columnWeight" from code?
body: <p>I am trying to assign the attribute "app:layout_columnWeight" from code. I tried to "GridLayout.LayoutParams" and apply a style to a template. I need to use this attribute because "android:layout_columnWeight" does not work in Api &lt;21.</p>
  
  <p>PS: I'm using android.support.v7.widget.GridLayout not android.widget.GridLayout.</p>
  
  <p>I attached the picture:</p>
  
  <p><a href="https://i.stack.imgur.com/WZ9Ev.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WZ9Ev.jpg" alt=""></a></p>
  
  <p>Thanks for your help.</p>
  
  <p><strong>EDIT:</strong>  not exactly, I've tried many things ...</p>
  
  <p>Layout-frame template (sample):</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/fonfo_monstruo"
      style="@style/monstruo"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="none"
          android:id="@+id/textView"
          android:layout_gravity="center"
          android:textColor="#ffffff" /&gt;
   &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>Frame style:</p>
  
  <pre><code>&lt;style name="monstruo"  &gt;
  &lt;item name="android:layout_margin" &gt;5dp&lt;/item&gt;
  &lt;item xmlns="http://schemas.android.com/apk/res-auto" name="layout_columnWeight" &gt;1&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>Grid on main XML layout:</p>
  
  <pre><code>    &lt;android.support.v7.widget.GridLayout
      app:orientation="horizontal"
      android:isScrollContainer="true"
      android:id="@+id/grid"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:columnCount="3"
      android:background="#cbb5ff"
      android:layout_marginBottom="100dp" /&gt;
  </code></pre>
  
  <hr>
  
  <p>onCreate:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
      android.support.v7.widget.GridLayout grid= (GridLayout) findViewById(R.id.grid);
      android.support.v7.widget.GridLayout.LayoutParams params=new android.support.v7.widget.GridLayout.LayoutParams();
      params.height=200;
      params.width=0;
  
      for (int i = 0; i &lt; 10; i++) {
  
          View newMonster=View.inflate(this,R.layout.layu_mosnter,null);
          newMonster.setLayoutParams(params);
          grid.addView(newMonster);
      }
  
  }
  </code></pre>