You can define shapes in xml (as you can see here) . eg
range hood / sample_shape.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FFFF0000"
android:endColor="#80FF00FF"
android:angle="45"/>
<padding android:left="7dp"
android:top="7dp"
android:right="7dp"
android:bottom="7dp" />
<corners android:radius="8dp" />
</shape>
xml drawable ImageButton.
/samplebutton.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/sample_shape" />
<item android:state_focused="true"
android:drawable="@drawable/sample_shape" />
<item android:drawable="@drawable/sample_shape" />
</selector>
:
<ImageButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/samplebutton">
</ImageButton>