title: Set weight (percentage) programmatically
body: <p>I've got two buttons that I'd like to dynamically weight give a preference.  They start out each with a weight of .5 (which of course adds to the LinearLayout's weight of 1), but if the preference is true, then I'd like to change their weights to .7 and .3 respectively.  I can set the weight in XML but I can't seem to find how to change it programmatically.</p>
  
  <hr>
  
  <p><strong>Solution</strong></p>
  
  <pre><code>LinearLayout.LayoutParams PO = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, .60f);
  LinearLayout.LayoutParams MO = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, .20f);
  </code></pre>