Hi, I find really hard to imagine that there's no way to know the actual Views' size before they are displayed.
I was expecting a sort of callback method on the Activity class or any listener on the View (or ViewGroup) to be implemeted so that I can get the size of UI components. Anyway, I found a sort of workaround which in the onCreate method of an Activity, I'll get a reference to the Display object thorugh the WindowManager display = this.getWindowManager().getDefaultDisplay(); Once I got the display, I can get the width and height of it and with that I can tweak some settings of some animations I want to apply on some UI components. Ideally, a callback method on the Activity which allows to know the actual size of UI components just before they are displayed would be preferred. Thanks, Mickey On 11 Apr, 07:51, Martin Obreshkov <[email protected]> wrote: > http://developer.android.com/reference/android/view/View.html#onMeasu..., > int) > > > > On Sun, Apr 11, 2010 at 7:56 AM, Kumar Bibek <[email protected]> wrote: > > I don't think you can get those before they are rendered. The final > > bounds will be decided only after the view is rendered, which might be > > different on different screen sizes, of course unless , the views are > > hard-coded with pixel sizes. > > > Thanks and Regards, > > Kumar Bibek > > > On Apr 11, 3:09 am, Mickey <[email protected]> wrote: > > > Hi There, > > > I'm a beginner of Android and I'm trying to understand how I can get > > > the size of a View (or a ViewGroup) before this is rendered on the > > > screen. > > > > What I'm trying to achieve is to apply some animations on some child > > > views and it would be great if there's a way to know in advance the > > > size of the parent view (ViewGroup) or any other child view before > > > this is displayed on the screen so that I can set some animations' > > > settings based on the measurements of other View objects. > > > > At the moment, some animations' settings are hard coded which I don't > > > like at all and I only discovered that I can get the parent view > > > measurements (height and width) after the ViewGroup is displayed. > > > > I couldn't find any obvious method or callback and I'm wondering if > > > there's any or amy technique useful to achieve my goal. > > > > Thanks in advance for any help. > > > > Mickey > > > -- > > 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]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > > To unsubscribe, reply using "remove me" as the subject. > > -- > When I raise my flashing sword, and my hand takes hold on judgment, I will > take vengeance upon mine enemies, and I will repay those who haze me. Oh, > Lord, raise me to Thy right hand and count me among Thy saints. -- 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

