You can simply use the onSizeChanged() method when you subclass TextView. On Tue, Mar 31, 2009 at 1:38 PM, fosta...@gmail.com <fosta...@gmail.com> 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 romain...@android.com 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---