Ok, thanks. I was thinking sublcassing TextView was somewhat heavy
handed for such a seemingly simple thing but barring any alternatives
it will do.

On Apr 2, 3:38 am, Romain Guy <[email protected]> wrote:
> You can simply use the onSizeChanged() method when you subclass TextView.
>
>
>
>
>
> On Tue, Mar 31, 2009 at 1:38 PM, [email protected] <[email protected]> 
> wrote:
>
> > Hi,
>
> > I have a TextView whereby the text size is scaled to fill as much
> > space as possible (I'm basically doing this by repeatedly calling a
> > Paint#getTextBounds() of the text until it is larger than the
> > TextView#getWidth(), if there is an easier way I would love to hear
> > it). I want the text to scale to fit if the TextView changes size.
>
> > I'm just wondering what the best way to do this is? I can't figure out
> > exactly when in an Activity lifecycle we know for sure the layout is
> > setup - when I call TextView#getWidth() in the Activity#onResume(), it
> > is 0. From what I've read I should be looking at the View#onSizeChanged
> > () method.
>
> > I'm not sure how to use this however. Should I be subclassing the
> > TextView to add my own setOnSizeChangedListener where I can update my
> > various TextViews? Or is there another established pattern for this?
>
> > cheers
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to