Hello,

I am trying to create a view that fits a text into a given text view.
I've done a new view that has a custom XML attribute called
minTextSize that is a dimension. Whenever text is set on the text
view, it tries with all sizes from the desired (specified in the xml)
down to minTextSize until it finds one that fits. This works perfectly
on an emulator, I get the desired behaviour but when I try it on my
HTC Desire, the calculated text width and the calculated width of the
text view doesn't seem to match.
I've tried both Paint.measureText, Paint.getTextWidths and
Paint.getTextBounds, all with the exact same result. Around 9
characters fit in the view but I have to write around 18 characters
before it starts making the font size smaller.
I use View.getWidth to measure the width of the view and it seems to
be correct since it claims to take 392 pixels out of the 480 available
(which looks about right).
The only thing I can think of is that measureText and getWidth uses
different units. Could that be the case? Do you have any other ideas
for me?
I've tried Stack Overflow and all answers I've seen uses one of the
three methods in Paint mentioned above.

I appriciate any help,
Schoel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to