title: How to set button selection color along with rounded corners in android?
body: <p>I want to set a rounded corner for a button in android along with changing the button color on  when selected. I am doing the following things.</p>
  
  <p>drawable/push_button.xml</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;item android:state_pressed="true"  android:drawable="@color/green"/&gt;
      &lt;item android:state_focused="true"  android:drawable="@color/green"/&gt;
      &lt;item android:state_focused="false"  android:drawable="@color/green"/&gt;
      &lt;item android:state_pressed="false" android:drawable="@color/red"/&gt;
      &lt;item  android:drawable="@drawable/push_button_background"/&gt;         
  &lt;/selector&gt;
  </code></pre>
  
  <p>drawable/push_button_background.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" 
      &gt;
      &lt;solid android:color="#3F4040"/&gt;
      &lt;corners 
      android:radius="7dp"
      /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>and in code, I am using</p>
  
  <pre><code>android:background="@drawable/push_button"
  </code></pre>
  
  <p>Here, the problem is, button colors are setting properly when selected &amp; deselected. But, rounded corners are not working.</p>
  
  <p>How to do that?
  If I use</p>
  
  <pre><code>android:background="@drawable/push_button_background"
  </code></pre>
  
  <p>then, rounded corners are working but the button color change on selection is not working</p>
  
  <p>How to implement this?</p>
  
  <p>I have referred <a href="https://stackoverflow.com/questions/5400852/round-cornered-button-with-background-color-in-android">this</a> link. Even then no help!!</p>