Skip to content

Instantly share code, notes, and snippets.

@StKotok
Last active July 15, 2017 17:43
Show Gist options
  • Save StKotok/13c8e4218f6e0b09618d22ea900b5d33 to your computer and use it in GitHub Desktop.
Save StKotok/13c8e4218f6e0b09618d22ea900b5d33 to your computer and use it in GitHub Desktop.
Button for API < 21
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_pressed="true">
<layer-list>
<!-- button background shadow -->
<item android:left="1dp" android:top="1dp">
<shape android:shape="rectangle">
<stroke android:width="3dp" android:color="@color/blue_shadow" />
<solid android:color="@color/transparent" />
<corners android:radius="6dp" />
<padding android:bottom="1.5dp" android:right="1.5dp" />
</shape>
</item>
<!-- button -->
<item android:left="1dp" android:top="1dp">
<shape>
<stroke android:width="2dp" android:color="@color/blue_pressed" />
<solid android:color="@color/transparent" />
<corners android:radius="6dp" />
</shape>
</item>
</layer-list>
</item>
<item>
<layer-list>
<!-- button background shadow -->
<item android:left="1dp" android:top="1dp">
<shape android:shape="rectangle">
<stroke android:width="3dp" android:color="@color/blue_shadow" />
<solid android:color="@color/transparent" />
<corners android:radius="6dp" />
<padding android:bottom="2dp" android:right="2dp" />
</shape>
</item>
<!-- button -->
<item>
<shape>
<stroke android:width="2dp" android:color="@color/blue" />
<solid android:color="@color/transparent" />
<corners android:radius="6dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment