title: Set gradient on stroke android
body: <p>I have a circular drawable on which I set a 8dp white stroke, like this:</p>
  
  <pre><code>    circleImage = (ImageView) rootView.findViewById(R.id.image);
      circleImage.setOnClickListener(clickListener);
      drawable = (GradientDrawable) circleImage.getBackground();
      drawable.setStroke(8, getResources().getColor(R.color.colorWhite));
  </code></pre>
  
  <p>The XML for <code>circleImage</code> looks like this:</p>
  
  <pre><code> &lt;ImageView
              android:layout_width="150dp"
              android:layout_height="150dp"
              android:layout_centerInParent="true"
              android:id="@+id/image"
              android:background="@drawable/roundcorner"
              android:clickable="true"/&gt;
  </code></pre>
  
  <p>What I want to do now is to change the <code>drawable.setStroke</code> to include a gradient color like this</p>
  
  <p><img src="https://i.imgur.com/lahG6v1.jpg" alt="1"></p>
  
  <p>I suppose the easiest way to achieve this is to write something in the drawable XML, but I don't quite know how to achieve this.</p>
  
  <p>roundcorner.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"  android:shape="rectangle" &gt;
          &lt;corners
              android:topLeftRadius="100dp"
              android:topRightRadius="100dp"
              android:bottomLeftRadius="100dp"
              android:bottomRightRadius="100dp"
              /&gt;
          &lt;padding
              android:left="2dp"
              android:top="2dp"
              android:right="2dp"
              android:bottom="2dp"
              /&gt;
          &lt;size
              android:width="100dp"
              android:height="100dp"
              /&gt;
      &lt;/shape&gt;
  </code></pre>