Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Last active May 4, 2019 09:33
Show Gist options
  • Save magdamiu/2398df7e6904ba4eaaa59b7a41cbfd5f to your computer and use it in GitHub Desktop.
Save magdamiu/2398df7e6904ba4eaaa59b7a41cbfd5f to your computer and use it in GitHub Desktop.
Shape drawable with stroke and gradient
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="0"
android:centerColor="#1976d2"
android:centerX="0.1"
android:centerY="0.1"
android:endColor="#6200ea"
android:gradientRadius="100"
android:startColor="#00e5ff"
android:type="linear" />
<padding
android:bottom="4dp"
android:left="5dp"
android:right="4dp"
android:top="4dp" />
<corners android:radius="6dp" />
<stroke
android:width="4dp"
android:color="@color/pink"
android:dashWidth="8dp"
android:dashGap="4dp" />
</shape>
// apply this file as a background to a button or other element
android:background="@drawable/shape_and_stroke"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment