title: Set gradient color for text in Android Studio with Kotlin language
body: <p>I have a text and I want to set a gradient color as its foreground. May I do it in XML?</p>
  
  <p>Or should I do it in an activity? I am programming with Kotlin in Android Studio.</p>
  
  <h3>File activity_main.xml</h3>
  
  <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#FFFFFF"
          android:gravity="center"
          android:text="Text Color is Gradient"
          android:textColor="#000"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.0"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <h3>File gradient.xml</h3>
  
  <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;gradient
          android:angle="90"
          android:centerColor="#555994"
          android:endColor="#b5b6d2"
          android:startColor="#555994"
          android:type="linear" /&gt;
  
      &lt;corners
          android:radius="0dp"/&gt;
  
  &lt;/shape&gt;
  </code></pre>
  
  <p>My activity is this:</p>
  
  <pre><code>import android.os.Bundle
  import androidx.appcompat.app.AppCompatActivity
  
  
  class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
      }
  }
  </code></pre>