If you want to make the 'EditText' behave like an IDE (i.e. eclipse) then you need to define a list of words that you want to be in different color then add a function like this:
EditText et = new EditText(mContext);
et.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
Then use the 'spanable' class to color your key words:
Spannable wordtoSpan = new SpannableString("I know just how to whisper, And I know just how to cry,I know just where to find the answers");
wordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 15, 30, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
et.setText(wordtoSpan);
You will need to implement some logic to find the starting and ending index of your key words and then iterate over the string to set the color of each item you want.