Use 2 (or More) Colors For A Button Text
I know I can change the color of the text on a button by the following ways :  button.setTextColor(getApplication().getResources().getColor(R.color.red)); //TAKE DEFAULT COLOR  or
Solution 1:
You should use ForegroundColorSpan
Try like this,
Buttonb= (Button) findViewById(R.id.button1);
        SpannableStringtext=newSpannableString("Click Here");
        // make "Clicks" (characters 0 to 5) Red
        text.setSpan(newForegroundColorSpan(Color.RED), 0, 5, 0);
        // make "Here" (characters 6 to 10) Blue
        text.setSpan(newForegroundColorSpan(Color.BLUE), 6, 10, 0);
        // shove our styled text into the Button
        b.setText(text, BufferType.SPANNABLE);
OutPut:

Hope this will help you.
Solution 2:
Yes it is possible
do like this
        Button btn = (Button) findViewById(R.id.btn);
        btn.setText(Html.fromHtml("<fontcolor='red'>Click</font>"
            + "<fontcolor='blue'> Here</font>"));
Post a Comment for "Use 2 (or More) Colors For A Button Text"