I am taking data of variable sizes from the server and setting to a textView and i wanted the textview to resize according to the length of the text set.
It is given in
Maybe you can try something like this:
EditText et = someEditText;
String text = et.getText().toString();
int textLength = text.length();
if (textLength > 25) {
et.setTextSize(toSomeNumber as the size of the text);
} else if (textLength > 15) {
et.setTextSize(toSomeNumber bigger than the previous);
} else {
et.setTextSize(toSomeNumber this is the biggest);
}
UPDATE : You can refer to this question if you want to solve your problem in more android way. How to set text size of textview dynamically for different screens
This is what I use for my own codes. Any suggestion is accepted to enhance my code. Hope it helps.