I have a text which has some other view overlapping with it (in a RelativeLayout
). 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.
I have tried using a TextView
for overlapping view and set its textColor
attribute but that does not work. Any help would be appreciated.
Edit: 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.
Edit: 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.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="#0000ff">
<View
android:layout_width="257dp"
android:layout_height="match_parent"
android:background="#ff0000"
android:layout_alignParentRight="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Hi I am some text"
android:textColor="#ffffff"/>
</RelativeLayout>