When specifying a drawable for a button, layout parameters are ignored
<p>I have added two buttons to my layout and specified some padding and it works fine. I also have these two buttons sitting inside an a linear layout whose visibility is set to gone (I set the layout to visible in code when certain conditions are met). </p>

<p>Then I decided to create some drawables for the buttons so that i can give them a different color and set the background property of the buttons to this drawable. But now the buttons ignore the padding parameters, and ignore that the linear layouts visibility is set to hidden and I cannot figure out why.</p>

<p>Here is the drawable</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android" &gt;
    &lt;!-- pressed --&gt;
    &lt;item android:state_pressed="true" android:drawable="@drawable/blue_button_press" /&gt;

    &lt;!-- focused --&gt;
    &lt;item android:state_focused="true" android:drawable="@drawable/blue_button_focus" /&gt; 

    &lt;!-- default --&gt;
    &lt;item android:drawable="@drawable/blue_button_default" /&gt;

&lt;/selector&gt;
</code></pre>

<p>Here is one of the button state drawables. The other two are the same as this just different colors.</p>

<pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt;

  &lt;stroke android:width="1dp" android:color="#FF404040" /&gt; 

  &lt;corners android:radius="6dp" /&gt; 

  &lt;gradient 
      android:startColor="@color/blue" 
      android:centerColor="@color/blue" 
      android:endColor="@color/blue"
      android:angle="90" /&gt;

  &lt;padding 
      android:left="10dp"
      android:right="10dp"
      android:top="10dp"
      android:bottom="10dp"
      /&gt;

&lt;/shape&gt;
</code></pre>

<p>And here is my layout file.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:tag="layout_single_view"
    android:id="@+id/moveList"&gt;

    &lt;fragment
        android:name="com.myapp.MyListFragment"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:id="@+id/list_fragment"
        android:layout_weight="45"&gt;
    &lt;/fragment&gt;

    &lt;TextView 
        android:id="@+id/offered_moves_warning"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/offered_move_warning"
        android:padding="10dip" /&gt;

    &lt;LinearLayout
        android:id="@+id/offered_moves_btns"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="20dip" 
        android:visibility="gone"&gt;

        &lt;Button
            android:id="@+id/btn_accept_plan"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/offered_move_accept" 
            android:layout_weight="1"
            android:textColor="@color/white"
            android:background="@drawable/blue_button_selector" 
            android:padding="10dip"/&gt;

        &lt;Button
            android:id="@+id/btn_reject_plan"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/offered_move_reject"
            android:layout_weight="1"
            android:textColor="@color/white" 
            android:padding="10dip"
            android:background="@drawable/blue_button_selector" /&gt;

    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>
