Pages

Saturday 8 October 2011

How to highlight text in android?


TextView txtview = (TextView)findViewById(R.id.txtid);
TV.setText("RorRaja Hooda, highlighted, italic", TextView.BufferType.SPANNABLE);
Spannable spantext = (Spannable)txtview.getText();
spantext.setSpan(new BackgroundColorSpan(0xFF00f8), 7, 16, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
TV.setText(spantxt);

No comments:

Post a Comment