Skip to content

Instantly share code, notes, and snippets.

@RyanParsley
Created August 22, 2012 19:05
Show Gist options
  • Save RyanParsley/3428446 to your computer and use it in GitHub Desktop.
Save RyanParsley/3428446 to your computer and use it in GitHub Desktop.
Android native button that resizes with texture, border and drop shadow
<layer-list>
<item>
<nine-patch android:src="@drawable/shadow_button" />
</item>
<item android:top="4dp" android:bottom="6dp" android:left="4dp" android:right="6dp">
<shape android:shape="rectangle">
<solid android:color="#86B9CC" />
<corners android:radius="3dp" />
</shape>
</item>
<item android:top="4dp" android:bottom="6dp" android:left="4dp" android:right="6dp">
<bitmap android:src="@drawable/texture_noise" android:tileMode="repeat"/>
</item>
<item android:top="4dp" android:bottom="6dp" android:left="4dp" android:right="6dp">
<shape android:shape="rectangle">
<solid android:color="#00000000"/>
<stroke
android:width="2dip"
android:color="#fff" />
<corners android:radius="3dp" />
</shape>
</item>
</layer-list>
@RyanParsley
Copy link
Author

The button was originally made in Illustrator. I expanded the appearance to separate the drop shadow effect so it could be pasted into Photoshop and turned into a 9 patch. There has to be an easier way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment