Is it possible to change the single textView size dynamically?
In the below link the text size is dynamically changed. ? can anyone guide me on how to do this. thanks in advance
Asked
Active
Viewed 658 times
2

RAAAAM
- 3,378
- 19
- 59
- 108
-
What do you mean by dynamically? Change the whole text to a specific size, or have a different size for each letter? – Carnal Sep 17 '13 at 07:39
-
Please refers the link may help you http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html http://stackoverflow.com/questions/1529068/is-it-possible-to-have-multiple-styles-inside-a-textview – Amit Sep 17 '13 at 07:39
-
buddy Do you have seperate textview for each letter that is in different textsize?? – Bhavin Nattar Sep 17 '13 at 08:02
-
Is your problem get solved? If you found any solution, you should post it.. – Chintan Rathod Sep 17 '13 at 10:40
3 Answers
1
Thanks for all, at-last i used three different textview to design whatever i need. Thanks for all.

RAAAAM
- 3,378
- 19
- 59
- 108
0
Try following code
span.setSpan(new RelativeSizeSpan(0.8f), start, end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Here, you need to set start
and end
as per your requirement. 0.8f
is size of text here. You need to pass float
value here.
Code
textView = (TextView) findViewById(R.id.textView);
Spannable span = new SpannableString(textView.getText());
span.setSpan(new RelativeSizeSpan(0.8f), 0, 7,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span.setSpan(new RelativeSizeSpan(1.8f), 7,
txt.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
txt.setText(span);
Output

Chintan Rathod
- 25,864
- 13
- 83
- 93