I am developing a text editor for my application, in which i want to edit the selected portion of text. And i am almost done with it except one feature, that to decrease the size of selected text.
I could increase the size like :
text=editor.getText();
text.setSpan(new RelativeSizeSpan(2f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
editor.setText(text);
But i am stuck with decreasing the size, How the size of text can be decreased ?
try the same way as you have used for increase textsize used code as shown below where editor is EditText
Spannable text=(Spannable)editor.getText();
text.setSpan(new RelativeSizeSpan(0.2f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
editor.setText(text);
in RelativeSizeSpan i have used 0.2f as a text size which will decrese your textsize you can use what ever size you need accordinglly