title: Android ignores layout_weight parameter from styles.xml
body: <p>It looks like android is ignoring layout parameters for ImageButton. When my layout xml defines ImageButtons with the style, layout_weight is considered. However, when I add the button dynamically, the weight is ignored and I have to define LayoutParameters manually.</p>
  
  <p>Styles.xml entry:</p>
  
  <pre><code>&lt;style name="TabbedPanelToolbarControl" parent="android:style/Widget.ImageButton"&gt;
      &lt;item name="android:background"&gt;@null&lt;/item&gt;
      &lt;item name="android:layout_width"&gt;wrap_content&lt;/item&gt;
      &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
      &lt;item name="android:layout_weight"&gt;1.0&lt;/item&gt;
      &lt;item name="android:paddingTop"&gt;5dp&lt;/item&gt;
      &lt;item name="android:paddingBottom"&gt;5dp&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>Layout xml:</p>
  
  <pre><code>...
  &lt;LinearLayout
      android:id="@+id/toolbar"
      android:orientation="vertical" &gt;
      &lt;!-- image buttons go here --&gt;
  &lt;/LinearLayout&gt;
  ...
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>View view = inflater.inflate(R.layout.test, container, false);
  LinearLayout mToolbar = (LinearLayout)view.findViewById(R.id.toolbar);
  
  ImageButton ib = new ImageButton(this.getActivity(), null, R.style.TabbedPanelToolbarControl);
  
  ib.setImageDrawable(icon);
  ib.setContentDescription(title);
  
  // ignored layout_weight defined in TabbedPanelToolbarControl style
  mToolbar.addView(ib);
  // need to re-specify layout
  mToolbar.addView(ib, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f));
  </code></pre>
  
  <p>Anyone knows a way to force reading of the layout_weight from styles.xml when adding buttons dynamically?</p>