title: Android - How to programmatically set the button style in a Linearlayout?
body: <p>I am programmatically creating a LinearLayout for an AlertDialog with some buttons.</p>
  
  <p>I <strong>WANT</strong> to do this:</p>
  
  <pre><code>&lt;LinearLayout android:id="@+id/footer" android:layout_width="fill_parent"
  style="@android:style/ButtonBar"&gt;
  </code></pre>
  
  <p>But with code like this:</p>
  
  <pre><code>LinearLayout buttons = new LinearLayout(parentContext);
  buttons.setOrientation(LinearLayout.HORIZONTAL);
  LinearLayout.LayoutParams buttonsParams =
      new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
      LayoutParams.WRAP_CONTENT);
  topLayout.addView(buttons, buttonsParams);
  buttons.setLayoutParams(buttonsParams);
  Button btnAdd = new Button(context);
  btnAdd.setText("Add");
  </code></pre>
  
  <p>How can I set the style of the buttons (use a button bar) programmitically?</p>