6

I'm +- new to android and was wondering if it's possible to change only part of the text color in a EditText widget... Actually i'm making a notepad app where you would be able, for example, to write "bblablabal" and then click on the "yellow" button and keep writing in yellow color (the text written before doesn't have to change, as it does with the .setTextColor() method).

I've tried some of the java methods and also tried some workarounds with no succes... any ideas of how to makes this works ?

Thank you! Rodrigo.

Rodrigo Manyari
  • 253
  • 2
  • 11

1 Answers1

4

Yes, that's possible. Take a look at SpannbleStringBuilder.

More details: Android: Coloring part of a string using TextView.setText()?

Community
  • 1
  • 1
inazaruk
  • 74,247
  • 24
  • 188
  • 156
  • Thank you for the quick answer inazaruk, but I think that's only possible as a static solution (you define the text b4 the compilation), what I would like to do is to change the font color on the fly, with a onclick or whatever, and keep writing in the edittext. Any hint will be really appreciated! Rodrigo. – Rodrigo Manyari Jun 30 '11 at 12:35