Q:

How to set text color for particular word in a sentence?

This is my response :
     Upto 1Feet $2
     After 3Feet $0.025

In this above response, I need to set green color for $2 and $0.025. Other text contains black color.
This is my xml Code,
          <android.support.v7.widget.CardView
                android:id="@+id/book_cardview_estimate_layout_driver"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/book_cardview_area_layout"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="13dp"
                android:layout_marginRight="13dp"
                android:layout_marginTop="30dp"
                android:background="#ffffff"
                android:visibility="visible"
                card_view:cardElevation="8dp">

                <RelativeLayout
                    android:id="@+id/estimate_layout_driver"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:background="#ffffff"
                    android:visibility="visible">

                    <com.mylibrary.widgets.CustomTextView
                        android:id="@+id/estimate_driver_text_upto"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:layout_marginTop="15dp"
                        android:layout_marginBottom="13dp"
                        android:text="Upto "
                        android:textColor="#000000"
                        android:textSize="15dp" />

                    <com.mylibrary.widgets.CustomTextView
                        android:id="@+id/estimate_driver_text_after"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/estimate_driver_text_upto"
                        android:layout_marginLeft="10dp"
                        android:layout_marginTop="13dp"
                        android:layout_marginBottom="15dp"
                        android:text="After"
                        android:visibility="visible"
                        android:textColor="#000000"
                        android:textSize="15dp" />
                </RelativeLayout>
            </android.support.v7.widget.CardView>

Here is java Code,
    Tv_estimate_driver_text_upto.setText(getResources().getString(R.string.upto) + " " + min_feet + getResources().getString(R.string.feet) + " " + sCurrencySymbol + min_fare);

  Tv_estimate_driver_text_after.setText(getResources().getString(R.string.after) + " " + after_per_feet + getResources().getString(R.string.feet) + " " + sCurrencySymbol + after_per_multi);

Explanation :
getResources().getString(R.string.upto)  = upto text,

min_feet  = 1 (its comes from json response),

getResources().getString(R.string.feet) = feet,

sCurrencySymbol  = $ (this comes from json response),

min_fare = 2 (some amount , comes from json response)

A:

Make your String as Html such as 
<b><font color=#FF0000>$2</font></b> and setText with Html.fromHtml()
such as 
    textview.setText(Html.fromHtml(getResources().getString(R.string.upto) + " " + min_feet +
     getResources().getString(R.string.feet) + 
" <font color=#00FF00>" + sCurrencySymbol + min_fare + "</font></b>"));

