diff options
| author | Alan Viverette <alanv@google.com> | 2015-04-30 21:03:22 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-30 21:03:23 +0000 |
| commit | ac7927a89519a79ab73723a13ed9ea12ca16056f (patch) | |
| tree | 2c5eb396ff62f4d7bb7e70e24aed5b0a9b39885d /core/java | |
| parent | cf2999aacf45506ff6f9c2876bfd4fd5a99fc394 (diff) | |
| parent | 84aa2fb65ab1ac99d6e59bd9d3398cfabc8cccc1 (diff) | |
| download | frameworks_base-ac7927a89519a79ab73723a13ed9ea12ca16056f.zip frameworks_base-ac7927a89519a79ab73723a13ed9ea12ca16056f.tar.gz frameworks_base-ac7927a89519a79ab73723a13ed9ea12ca16056f.tar.bz2 | |
Merge "LayoutInflater should always try to generate LayoutParams for include" into mnc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/LayoutInflater.java | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 457d6ad..1503728 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -946,25 +946,21 @@ public abstract class LayoutInflater { attrs, R.styleable.Include); final int id = a.getResourceId(R.styleable.Include_id, View.NO_ID); final int visibility = a.getInt(R.styleable.Include_visibility, -1); - final boolean hasWidth = a.hasValue(R.styleable.Include_layout_width); - final boolean hasHeight = a.hasValue(R.styleable.Include_layout_height); a.recycle(); - // We try to load the layout params set in the <include /> tag. If - // they don't exist, we will rely on the layout params set in the - // included XML file. - // During a layoutparams generation, a runtime exception is thrown - // if either layout_width or layout_height is missing. We catch - // this exception and set localParams accordingly: true means we - // successfully loaded layout params from the <include /> tag, - // false means we need to rely on the included layout params. + // We try to load the layout params set in the <include /> tag. + // If the parent can't generate layout params (ex. missing width + // or height for the framework ViewGroups, though this is not + // necessarily true of all ViewGroups) then we expect it to throw + // a runtime exception. + // We catch this exception and set localParams accordingly: true + // means we successfully loaded layout params from the <include> + // tag, false means we need to rely on the included layout params. ViewGroup.LayoutParams params = null; - if (hasWidth && hasHeight) { - try { - params = group.generateLayoutParams(attrs); - } catch (RuntimeException e) { - // Ignore, just fail over to child attrs. - } + try { + params = group.generateLayoutParams(attrs); + } catch (RuntimeException e) { + // Ignore, just fail over to child attrs. } if (params == null) { params = group.generateLayoutParams(childAttrs); |
