Redrori
Redrori

Reputation: 41

Auto Scale TextView Text to Fit within Bounds in 4.0

The solution Chase gave for this problem was working fine in 2.2 - 3.2 but when I tested it on 4.0 it failed.

Here is the original post:

Auto Scale TextView Text to Fit within Bounds

On 4.0 I get a strange line spacing problem which brings me to something he/she wrote in his/her code:

// Some devices try to auto adjust line spacing, so force default line spacing 
// and invalidate the layout as a side effect
   textPaint.setTextSize(targetTextSize);
   setLineSpacing(mSpacingAdd, mSpacingMult);

I guess this is failing now and I'm not sure why (anyone?). Also not sure why he/she wrote it in the first place as isn't this OS dependent and not a device dependent problem?

Upvotes: 3

Views: 1220

Answers (1)

user1139880
user1139880

Reputation: 1838

ICS has TextView resizing issue where in some conditions it will resize up but not down. This black magic works for me. After you set the text of your TextView, also perform this

textView.append("\uFEFF");

Upvotes: 1

Related Questions