title: Android: Add neon glow effect to button
body: <p>I want to have a glow effect on button (in android studio) as shown in image:</p>
  <p><a href="https://i.stack.imgur.com/vTGsO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/vTGsO.jpg" alt="Button design image" /></a></p>
  <p>I didn't want an image for the background, so to get this effect, I have tried to do in xml file. I have added a stroke for the button and provide a shadow to the button (with same color as stroke).</p>
  <p>I have used a linear gradient with 90 degree angle with start and end color same as the stroke, center color same as background color. Please see the code:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
  &lt;item&gt;
      &lt;layer-list&gt;
          &lt;item android:right=&quot;5dp&quot; android:top=&quot;0dp&quot;&gt;
              &lt;shape&gt;
                  &lt;corners android:radius=&quot;50dp&quot; /&gt;
                  &lt;gradient
                      android:angle=&quot;45&quot;
                      android:startColor=&quot;#8008c3fa&quot;
                      android:endColor=&quot;#8008c3fa&quot;
                      android:type=&quot;linear&quot;
                      /&gt;
              &lt;/shape&gt;
          &lt;/item&gt;
          &lt;item android:bottom=&quot;5dp&quot; android:left=&quot;6dp&quot; android:right=&quot;10dp&quot; android:top=&quot;5dp&quot;&gt;
              &lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; android:shape=&quot;rectangle&quot; &gt;
                  &lt;corners
                      android:radius=&quot;50dp&quot;
                      /&gt;
                  &lt;gradient
                      android:angle=&quot;90&quot;
                      android:centerX=&quot;50%&quot;
                      android:centerColor=&quot;@color/trans_parent&quot;
                      android:startColor=&quot;#8008c3fa&quot;
                      android:endColor=&quot;#8008c3fa&quot;
                      android:type=&quot;linear&quot;
                      /&gt;
                  &lt;padding
                      android:left=&quot;0dp&quot;
                      android:top=&quot;0dp&quot;
                      android:right=&quot;0dp&quot;
                      android:bottom=&quot;0dp&quot;
                      /&gt;
                  &lt;size
                      android:width=&quot;270dp&quot;
                      android:height=&quot;60dp&quot;
                      /&gt;
                  &lt;stroke
                      android:width=&quot;2.5dp&quot;
                      android:color=&quot;#08c3fa&quot;
                      /&gt;
              &lt;/shape&gt;
          &lt;/item&gt;
      &lt;/layer-list&gt;
  &lt;/item&gt;
  
  &lt;/selector&gt;
  </code></pre>
  <p>For the above xml, I got the below result:</p>
  <p><a href="https://i.stack.imgur.com/0rQXk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0rQXk.png" alt="Result image from code" /></a></p>
  <p>Though the design and the result images look totally different, I think if we increase the center color height and keep a fadeout effect to the shadow, it can work. But I'm not able to do the same.</p>