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 <scythe...@gmail.com> 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? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en