Skip to main content

Android Button Shape and Selector Together

-

<selector xmlns:android="https://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">

        <shape android:shape="oval">
            <gradient android:angle="135" android:endcolor="@color/jd_red" android:startcolor="@color/green">
            <corners android:radius="20dp">
            <stroke android:color="@android:color/black" android:width="2dp">
        </stroke></corners></gradient></shape>

    </item>

    <item>
        <shape android:shape="rectangle">
            <gradient android:angle="225" android:endcolor="@color/green" android:startcolor="@color/jd_red">
            <corners android:radius="@dimen/btn_corner_radius">
            <stroke android:color="@android:color/black" android:width="4dp">
        </stroke></corners></gradient></shape>

    </item>
</selector>