title: How to create horizontal gradient for text color of AppCompatButton in android
body: <p>I wanted to generate horizontal text color gradient for my <code>AppCompatButton</code>. I was able to accomplish the vertical text color gradient by</p>
  
  <pre><code>val signInBtn = view.findViewById&lt;AppCompatButton&gt;(R.id.btn_sign_in)
  val textShader = LinearGradient(0f, 0f, 0f, signInBtn.textSize,
              ContextCompat.getColor(context, R.color.gradient_start),
              ContextCompat.getColor(context, R.color.gradient_end), TileMode.CLAMP)
  signInBtn.paint.shader = textShader
  </code></pre>
  
  <p>I've tried changing the x2 values, but nothing seems to work. Any help would be appreciated.</p>
  
  <p>here is my button xml layout</p>
  
  <pre><code>&lt;android.support.v7.widget.AppCompatButton
      android:id="@+id/btn_sign_in"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginEnd="@dimen/big"
      android:layout_marginStart="@dimen/big"
      android:layout_marginTop="@dimen/big"
      android:background="@color/white"
      android:text="@string/sign_in"
      android:textAllCaps="false"
      android:fadingEdge="horizontal"
      android:scrollHorizontally="true"
      android:textColor="@color/white"/&gt;
  </code></pre>