You would set your android:background="@android:....
to be a drawable:
android:background="@drawable/myellipsebutton"
Then add a drawable called myellipsebutton.xml
:
- Resource/Drawable/myellipsebutton.xml
In this drawable resource, you can define the shape of the button, in this case I'm using oval
instead of rectangle
, line
and ring
are also available:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="oval">
<gradient android:startColor="#F44336" android:endColor="#E57373" android:angle="270" />
<stroke android:width="10dp" android:color="#607D8B" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="oval">
<gradient android:startColor="#3F51B5" android:endColor="#9FA8DA" android:angle="270" />
<stroke android:width="10dp" android:color="#607D8B" />
</shape>
</item>
<item>
<shape android:shape="oval">
<gradient android:startColor="#2196F3" android:endColor="#BBDEFB" android:angle="270" />
<stroke android:width="1dp" android:color="#607D8B" />
</shape>
</item>
</selector>
