title: How to programatically add LinearLayout with background color, and weight to another layout
body: <p>I have LinearLayout in xml:</p>
  
  <pre><code>    &lt;LinearLayout
          android:id="@+id/progress"
          android:layout_width="fill_parent"
          android:layout_height="@dimen/progress_height"
          android:layout_alignParentBottom="true"
          android:baselineAligned="false"
          android:orientation="horizontal" /&gt;
  </code></pre>
  
  <p>and I would like to generate dynamically few another LinearLayouts and put them to "progress" equaly spaced, for example:</p>
  
  <ul>
  <li>First LinearLayout added will occupy all the space.</li>
  <li>Second LL will share 50% of the space with 1LL</li>
  <li>Third LL will share 33% of the space with 1LL and 2LL</li>
  <li>and so on...</li>
  </ul>
  
  <p>Every LinearLayout will have random background color
  I wrote something like this:</p>
  
  <pre><code>mProgress = (LinearLayout) findViewById(R.id.progress);
  .
  .
  .
  LinearLayout prog = new LinearLayout(this);
              prog.setBackgroundColor(CommonUtils.getNextRandomColor());
              LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                      LinearLayout.LayoutParams.MATCH_PARENT,
                      LinearLayout.LayoutParams.MATCH_PARENT, 1.0f);
  
              prog.setLayoutParams(params);
              mProgress.addView(prog);
  </code></pre>
  
  <p>When user press the buttons, another LL will generate, with different color.</p>
  
  <p>My method doesn't work. There is no background color in layouts.</p>
  
  <p>Maybe there is another much simpler method to achive some kind of progress bar with colors sharing some space equally?</p>