I\'m not sure that this is possible, perhaps someone can set me straight. I have an EditText View in an android application that has white text on a blue background. When the te
Object mSelectionForegroundColorSpan;
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
super.onSelectionChanged(selStart, selEnd);
if(mSelectionForegroundColorSpan == null){
mSelectionForegroundColorSpan = new ForegroundColorSpan(Color.GREEN);
}else{
getText().removeSpan(mSelectionForegroundColorSpan);
}
if(selStart > selEnd){
int swap = selStart;
selStart = selEnd;
selEnd = swap;
}
getText().setSpan(mSelectionForegroundColorSpan, selStart, selEnd, Spanned.SPAN_INTERMEDIATE);
}
Override the onSelectionChanged method of TextView, get the text and set a ForegroundColorSpan