Thanks!
Kind Regards, Matt Tatro T: +1 (281) 905-1008 E: <mailto:[email protected]> [email protected] <http://www.linkedin.com/pub/matt-tatro/8/17a/363> Description: images <http://www.twitter.com/mtatro> Description: twitter <skype:matt.tatro?call> Description: skype <http://www.tungle.me/mtatro> Description: tungle From: Kostya Vasilyev [mailto:[email protected]] Sent: Saturday, August 06, 2011 12:01 PM To: [email protected] Cc: Matt Tatro Subject: Re: [android-developers] Re: Is there a callback that gets called right after onResume() ? Sure. I'd start here: http://developer.android.com/guide/topics/ui/custom-components.html The layout process involves these three onXXX overrides, as listed in the table halfway down the page: onMeasure(int, int) onLayout(boolean, int, int, int, int) onSizeChanged(int, int, int, int) There is documentation for each of these three methods, as well, such as: http://developer.android.com/reference/android/view/View.html#onSizeChanged(int, int, int, int) -- Kostya 06.08.2011 22:54, Matt Tatro пишет: Kostya, Any example I could follow? Kind Regards, Matt Tatro T: +1 (281) 905-1008 E: [email protected] -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kostya Vasilyev Sent: Saturday, August 06, 2011 11:51 AM To: [email protected] Subject: Re: [android-developers] Re: Is there a callback that gets called right after onResume() ? Or one could use the tools already provided by the framework ... ... by subclassing a xxxLayout class or a ViewGroup and overriding onMeasure and onLayout ... ... or by subclassing the appropriate view and overriding onSizeChanged ... -- Kostya 06.08.2011 20:42, Jim пишет: There is no callback - you can set flags in onResume() to know when the activity is done with that part of the lifecycle. However, by using layout_weight, you're telling Android to decide the size, which it can't know until the screen is drawn, so a callback to change the size won't work without a Handler to request a redraw or cycling through onPause/onResume. So, you're going to need a Handler, which is effectively a hack (to avoid layout_weight, you can get screen and view dimensions and other data during onCreate/onStart/onResume to calculate the available screen space yourself, determine which elements will show and then calculate/recalculate certain element sizes to get what you want, but that's a lot of work - a hack is probably a better approach for this type of job). If you want to determine the available size, then start a background thread/timer at the end of onResume(), when you know how much space you have for your elements, do the size calculations, then runOnUIThread the changes and you should be fine. If you want to guarantee the user does not see the changes, you're going to have to work harder since the background thread/timer is not synchronized with the UI. -Jim On Aug 6, 2:58 am, Zsombor <mailto:[email protected]> <[email protected]> wrote: Is there a callback that gets a call when everything in the current Activity got rendered? Because I need to know the exact sizes of some of my ViewGroups (their width/height are set using layout_weight in the layout xml), so I know how many elements fit inside them without scrolling. But I can only measure them after onResume. Is there a way to do this without some hack? -- Kostya Vasilyev -- 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 -- Kostya Vasilyev -- 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
<<image001.jpg>>
<<image002.gif>>
<<image003.png>>
<<image004.gif>>

