title: How to show a text in 2 colors in android?
body: <p>I have a text which has some other view overlapping with it (in a <code>RelativeLayout</code>). I want the part of text inside the overlapping view of a different color and that outside the view of different color. Please see the sample image for the same.</p>
  
  <p>I have tried using a <code>TextView</code> for overlapping view and set its <code>textColor</code> attribute but that does not work. Any help would be appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/VssiI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VssiI.png" alt="Image with text overlapping with a view"></a></p>
  
  <p><strong>Edit:</strong> As shown in the image, I want that some part of 'a' should be of different color and the rest inside oval to be of different color.</p>
  
  <p><strong>Edit:</strong> Consider the following sample code which illustrates my purpose. Here letter 'm' has some part inside the other part (red one). Currently all text is in white. What I need is that the part just after the boundary (from where the red color view starts) all text to be in black color. The screen shot is also attached below. Hope now I am clear.</p>
  
  <pre><code>        &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="20dp"
              android:background="#0000ff"&gt;
  
              &lt;View
                  android:layout_width="257dp"
                  android:layout_height="match_parent"
                  android:background="#ff0000"
                  android:layout_alignParentRight="true"/&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:text="Hi I am some text"
                  android:textColor="#ffffff"/&gt;
  
          &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QhhFx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QhhFx.jpg" alt="Android app screen shot"></a></p>