[android-developers] Can onMeasure be skipped when adding a View to a ViewGroup?
I have a RelativeLayout where I am adding views dynamically as the
user scrolls vertically or horizontally. I have rolled my own
ViewRecycler since there is potentially thousands of views that could
compose the whole of what can be scrolled, but I only show 30 or so at
any time. Think a zoomed in view of a calendar.
I am running into performance problems when I add the views that are
about to be seen, onMeasure is called on the RelativeLayout cascading
down to onMeasure getting called on all of it's child views. I already
have the calculated size of how big the RelativeLayout will ever be
and have set that on it's LayoutParameters, so measuring the ViewGroup
isn't necessary, nor is re-measuring the Views that have already been
added with their final size and the newly added view has no bearing on
those views.
Is there a recommended way to bypass these onMeasure calls or at least
onMeasure calling measureChildren?
Also posted this on stackoverflow with example code to demonstrate the
undesired behavior: http://stackoverflow.com/questions/6298827/can-onmeasure-be-skipped-when-adding-a-view-to-a-viewgroup
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home