OSDN Git Service

View measurement optimization
authorAdam Powell <adamp@google.com>
Wed, 15 Oct 2014 02:15:18 +0000 (19:15 -0700)
committerAdam Powell <adamp@google.com>
Wed, 15 Oct 2014 19:20:36 +0000 (12:20 -0700)
commit9cefbda11ee5308145d58b0b99ced0f66a0b1cf9
tree4f6f4796b9bf3aca6b2e953aea78279cdd400f02
parent074c5b5b65295ee57c4223360604aba51479d783
View measurement optimization

If a view hasn't explicitly requested layout and it's asked to measure
with MeasureSpec.EXACTLY in both dimensions and sizes that match its
current measured size, the measure operation is a no-op.

This helps out a number of ViewGroups that perform initial speculative
measurements with AT_MOST or UNSPECIFIED followed by looping over
child views and measuring EXACTLY to lock in the final measurement
with perhaps some extra leftover space distributed. In practice this
happens a fair bit, especially for views high up in the view
hierarchy. This optimization allows ViewGroup measurement code to be a
little cleaner in not having to keep track of this on its own.

Change-Id: I88ff46a7d37aeda7a4cd16204b68cab0d051b341
core/java/android/view/View.java