title: How to make gradient background in android
body: <p>I want to create gradient background where the gradient is in the top half and there's a solid color in the bottom half, like in this image below:</p>
  
  <p><img src="https://i.stack.imgur.com/Woq2z.jpg" alt=""></p>
  
  <p>I can't because the <code>centerColor</code> spreads out to cover the bottom and top. </p>
  
  <p><img src="https://i.stack.imgur.com/bbo6D.jpg" alt="In the gradient for the button, a white horizontal line fades over blue toward the top and botton."></p>
  
  <p>How can I make a background like the first image? How can I make small <code>centerColor</code> that's not spread out?</p>
  
  <p>This is code in XML of background button above.</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt;
      &lt;gradient 
          android:startColor="#6586F0"
          android:centerColor="#D6D6D6"
          android:endColor="#4B6CD6"
          android:angle="90"/&gt;
      &lt;corners 
          android:radius="0dp"/&gt;
  
  
  &lt;/shape&gt;
  </code></pre>