Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I discovered that this can all be done in one file fairly easily. Put something like the following code in a file named <code>custom_button.xml</code> and then set <code>background="@drawable/custom_button"</code> in your button view:</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" &gt; &lt;shape&gt; &lt;gradient android:startColor="@color/yellow1" android:endColor="@color/yellow2" android:angle="270" /&gt; &lt;stroke android:width="3dp" android:color="@color/grey05" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:state_focused="true" &gt; &lt;shape&gt; &lt;gradient android:endColor="@color/orange4" android:startColor="@color/orange5" android:angle="270" /&gt; &lt;stroke android:width="3dp" android:color="@color/grey05" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/blue2" android:startColor="@color/blue25" android:angle="270" /&gt; &lt;stroke android:width="3dp" android:color="@color/grey05" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/selector&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload