OSDN Git Service
Grid Layout and Convert to Grid Layout improvements
First, some improvements to Grid Layout handling:
(1) When dropping a new widget, look up the sizing metadata and use it
to determine what fill gravity to set. For example, a button will
use gravity left, and a text field will use gravity
fill_horizontal.
(2) Don't warn about reflection problems when failing to find
GridLayout layout data; this probably means the layout is being
attempted opened in an unsupporting SDK. There's a fallback case
to compute the data instead already.
Second, improvements to the conversion to GridLayout handling:
(1) It now looks at the layout_gravity values to see whether each row
and column is flexible, and if there's no flexible column in each
of the horizontal and vertical dimensions, it will insert a
special <Space> element to absorb any available extra space. This
avoids constraints warnings from GridLayout.
(2) It treats layout_width or layout_height attributes of match_parent
or fill_parent as the same as a fill gravity (and removes it) and
uses this in the flexibility computation above.
(3) It removes unsupported layout params for all children (earlier
this would only remove unsupported layout params on the direct
children of the layout, which isn't enough when a hierarchy is
being flattened.)
(4) It's smarter about computing implicit rows and columns, so it
avoids writing out redundant layout_row and layout_column
attributes in some cases.
(5) It avoids throwing refactoring errors in cases where an attribute
is removed twice
(6) Fixes a bug where the root layout was included when computing the
set of used x and y coordinates, which means you'd often end up
with a blank row and column 0.
(7) Various refactoring to make the code cleaner.
(8) More unit tests and updates to existing unit tests to reflect the
new behavior such as an absorbing spacer and removal of redundant
attributes.
Change-Id: Iee44c3ca749eefc107b83545669cc9d7f84615b1
15 files changed: