Skip to content

Instantly share code, notes, and snippets.

@StKotok
Last active July 15, 2017 17:24
Show Gist options
  • Save StKotok/2422caad7b055b7243b276f869bbea9d to your computer and use it in GitHub Desktop.
Save StKotok/2422caad7b055b7243b276f869bbea9d 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="2dp" android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/blue_shadow" />
<corners android:radius="6dp" />
<padding android:bottom="1.5dp" android:right="1.5dp" />
</shape>
</item>
<!-- button -->
<item android:left="1dp" android:top="1dp">
<shape>
<solid android:color="@color/blue_pressed" />
<corners android:radius="6dp" />
</shape>
</item>
</layer-list>
</item>
<item>
<layer-list>
<!-- button background shadow -->
<item android:left="2dp" android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/blue_shadow" />
<corners android:radius="6dp" />
<padding android:bottom="2dp" android:right="2dp" />
</shape>
</item>
<!-- button -->
<item>
<shape>
<solid android:color="@color/blue" />
<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