Reputation: 157
I am new in android and I am writing code for counter. I am showing the increasing count in the text view. If there are four digits in the text view, it shows normally, but when counter value is greater than 9999, text view showing 5 digits. Problem is that these five digits are not in single line. I want to know if there is any function or method by which text size in the text view can be change dynamically. Is there any if condition to be used like
If(counter > 9999){ change text size to any value, less than the previous value given in the xml file. } Any help will be highly appreciated
Upvotes: 0
Views: 459
Reputation: 844
Warning: This is pseudocode!
TextView myTextView = (TextView) findViewById(R.id.mytextviewID);
if(myTextView.getText() < 9999)
{
myTextView.setTextSize(DpValueAsInt);
}
Upvotes: 1